views:

136

answers:

2

I use GetForegroundWindow to get the foreground window handle but if there is no window, then it returns the HWND to the desktop. How do I know if the HWND is the desktop?

+14  A: 

Compare it with the result of calling GetDesktopWindow().

anon
+7  A: 

Compare the handle with the handle returned by GetDesktopWindow().

kusma