WindowFromDC
-
Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!
-
Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!
In windows 7, WindowFromDC() works fine. Following code gives Desktop window handle.
HDC hDcDesktop = ::GetDC(0); HWND hWindowDesktop1 = ::WindowFromDC(hDcDesktop);
How you are getting the DC to Desktop ?
-
Hello all! I am trying to determine if a HDC points to the desktop. To do that I use WindowFromDC() which works fine under XP but returns 0 under Vista/7. Is there any way to determine it using some other method?? Thank you all very much!!
To get the desktop window handle I use the GetDesktopWindow function.
HWND hwndDesktop = GetDesktopWindow()