I've tried googling for this but it seems this question remains unanswered. Is there anyway to check if the user's current active window is the desktop?
This always reports the desktop is inactive, even when all windows are minimized to the taskbar and only the desktop is visible. Doing a net search doesn't bring up any methods either.
Using GetActiveWindow() instead of GetForegroundWindow() gives the same output.
Maybe also there is some Win32 "trick" I am missing and it is quite easy to check if the Desktop is the active window.
Well, it would help if I actually checked each loop for what the active window is, code revised. Still won't detect the desktop as being the active window. Ooops! :|
Well, it would help if I actually checked each loop for what the active window is, code revised. Still won't detect the desktop as being the active window. Ooops! :|
Still won't detect the desktop as being the active window.
That's because it's actually a child of the desktop which gets the focus.
On my Windows 10 PC, it's a child window named "Program Manager"of window class "Progman", but if the system is showing wallpaper then different windows are involved.
This problem was discussed on this site a few years ago: