• Welcome to Valhalla Legends Archive.
 

Get Device Caps

Started by Akamas, April 07, 2004, 07:31 PM

Previous topic - Next topic

Akamas

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.
Quote from: Arta[vL] on August 14, 2006, 04:57 PM
Well, I want some too. Greedy Yoni should stop hogging it.

Eibro

#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.
Eibro of Yeti Lovers.

Akamas

Alright, I'll try that tommorrow at work, thanks alot for your assistance.
Quote from: Arta[vL] on August 14, 2006, 04:57 PM
Well, I want some too. Greedy Yoni should stop hogging it.