I developing a small program that I want working as a widget, and would like to display it only when no window has focus - or when the desktop window has focus.

My best chance now is finding whether GetFocus() returns NULL but this is not working as suspected. I've also tried with GetForegroundWindow() and the windows returned with GetGUIThreadInfo().

Thank you.

Nevermind, I finally managed to figure it out. For those wondering:

if(GetShellWindow() == GetForegroundWindow())
   //Then the desktop is in focus
commented: nice one :) +27
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.