I once used the GetForegroundWindow() function to determine if a splash screen was running. If the return value was NULL , then a screen saver is active (or, presumably, a locked workstation). Please note that this was in the early days of Windows NT, not documented to do this, and there is no guarantee that it will still do the same today.
Looking at the Win32 API link, you can use something like OpenInputDesktop() to get the HDESK current active desktop. If you cannot get a desktop descriptor or if it is different from the desktop of your thread, your application runs on a desktop that is inactive (and the workstation is probably either in a splash screen state or locked). There is no guarantee that this method will work, but it may be worth exploring.
Greg hewgill
source share