Environment: MS Visual Studio 2008. (Please transfer this thread to where it belongs.)
Project type: Windows Forms Control Library.
Goal: Get the pixel color from a given process' main window.
Already achieved: I got the desired process's pointer by using
Ok, but how do I "get" the hDc? I'm tired of searching. The google answers doesnt work on my compiler/version/project.
How do I point out which window/hWND do I want to get its hDC?
What type is the function that gets me the hDC?
GetDC is my function. How do I include the "Header: Winuser.h (include Windows.h)"?
Is the header the only thing I must include for the GetDC() function to work?
My project begins with
using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Drawing::Imaging;
public ref class Form1 : public System::Windows::Forms::Form
//TODO: Add the constructor code here
I dont even know what "#pragma once" stands for. These Windows Forms are not like the projects I've been studying on.
Thank you very much. You helped me a lot.
From this code:
IntPtr hWnd = Proc->MainWindowHandle;
void *handle = hWnd.ToPointer();
HWND hand = reinterpret_cast<HWND>(handle);
HDC h = GetDC(hand);
h = NULL;
HDC myHDC = GetDC(hand);
GetPixel(myHDC, 100, 100);
GetPixel() does not take 3 arguments. Whats the model of the GetPixel() that I need?
In the library for Windows Forms I find only GetPixel(POINT point) or GetPixel( int coordinate_1, int coordinate_2 )
You've been very helpful!