BUG: SystemParametersInfo with SPI_GETSCREENSAVEACTIVE Always Returns True on Windows 2000 (318781)
The information in this article applies to:
This article was previously published under Q318781 SYMPTOMS
The SystemParametersInfo function with the uiAction parameter set to SPI_GETSCREENSAVEACTIVE returns True although no screen saver is active.
RESOLUTION
You can work around this problem by querying the registry to check whether the screen saver is active. The presence of the Scrnsave.exe file under the registry key HKCU\Control Panel\Desktop indicates that the screen saver is active.
The following sample code demonstrates this condition:
HKEY hKeySreenSaver = NULL;
long lReturn = NULL;
long lScreenSaver = NULL;
DWORD dwData = NULL;
lReturn = RegOpenKeyEx(HKEY_CURRENT_USER,
TEXT("Control Panel\\Desktop"),
0,
KEY_QUERY_VALUE,
&hKeySreenSaver);
if(lReturn == ERROR_SUCCESS)
{
lScreenSaver = RegQueryValueEx(hKeySreenSaver,
TEXT("SCRNSAVE.EXE"),
NULL,
NULL,
NULL,
&dwData);
if(lScreenSaver == ERROR_SUCCESS)
MessageBox(NULL,
"Screen Saver is Active",
"Screen Saver",
MB_OK);
else
MessageBox(NULL,
"Screen Saver is Not Active",
"Screen Saver",
MB_OK);
}
RegCloseKey(hKeyScreenSaver);
hKeyScreenSaver = NULL;
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 4/30/2002 |
---|
Keywords: | kbbug kbDSupport KB318781 |
---|
|