GetDeviceCaps(hDC, COLORRES) == 18
I need to use the above code in an if statement in a MFC application but I cannot get it to work because VC6++ tells me that hDC is undeclared which isn't true because just before this code I declare the following:
HDC hDC;
It seems I can't retrieve the device context properly for some reason. I am trying to run this code from a dialog box, I don't know if that is part of the problem or not. Most likely you'll need the code here it is.
HDC hDC;
HWND hWnd;
hDC = GetDC(hWnd);
if (GetDeviceCaps(hDC, COLORRES) == 18)
{
AfxMessageBox("My Message");
}
ReleaseDC(hWnd, hDC);
This is the exact code I use but still hDC and hWnd are said to be undeclared by the compiler.
#include <windows.h>
Also, don't do this:
HWND hWnd;
hDC = GetDC(hWnd);
hWnd is uninitialized, either pass GetDC a valid window handle or NULL.
Alright, I'll try that tommorrow at work, thanks alot for your assistance.