--
Ole Perch Jensen <olep...@zaphod.ping.dk>
: --
Yes, I just wrote something that does this because neither this
newsgroup, Microsoft VB support, nor the Microsoft SDK group could tell
me how to find out what message Windows puts out when the system has
become idle. I found that this was an acceptable kluge for an otherwise
perplexing problem. Most of this, except for the WindowsScreenSaverClass
name, is from the KnowlegeBase article number Q112649
Here's what you do to find out if a standard Windows supplied screensaver
is running:
In your global declarations on one line:
Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,
ByVal lpCaption As Any)
in a timer place this code:
lpClassName$="WindowsScreenSaverClass"
'and add an IF statement or other branch statement to check for activity,
'for example:
if FindWindow(lpClassName$, 0&)=0 then
'screensaver NOT active
else if FindWindow(lpClassName$, 0&)<>0 then
'screensaver IS active
end if
This code will continuously, at your timer's interval, check for the
activity of a standard windows screensaver. It WILL NOT work with
AfterDark or similar standalone screensavers. For that you will need to
determine the class name for those specific programs using SPY.EXE or
similar.
Hope this helps,
Tracy
I posted the wrong KnowlegeBase article number in my last response. The
correct number is Q72918.
Cheers,
Tracy
for what it's worth:
1. Windows post a WM_SYSCOMMAND, SC_SCREENSAVE to the active window
before it starts the screen saver application.
2. You can hook into the notifyRegister chain to detect when the
screen saver application starts and ends.
All this pre-supposes that the screen saver follows windows
conventions.
Steve