Re: Simulate user interaction - Avoid screen saver activation




"Card.Starzinger" <cardstarzinger@xxxxxxxx>, haber iletisinde þunlarý
yazdý:0Ydce.1306282$35.48491839@xxxxxxxxxxxxxxx
> Hi!
>
> I need help to simulate programmatically user interaction on WinNT 4.0, to
> avoid screen saver activation.
>
> I try with key injection event.
>
> SendInput API and keybd_event API work correctly with Win2000 and WinXP
> system. Screen saver don't start.
>
> Under WinNT 4.0 these API, inject key event correctly at active
application
> (ex. notepad) but system screen saver start !!!! :(
>
> I can use another windows API to avoid screen saver and simulate a user
> interaction ? I can use dos-bios interrupt for inject key avent under
> WINNT4.0 ? I can use a WINNT API to call bios interrupt routine?
>
> Thanks for your help!!!
>
>
>
>
>
I needed something like that recently under WinNT 4.0 (but it works under XP
as well). Here is my working code (in C++).

struct KScreenSaver
{
BOOL enabled;
BOOL enabledx;
int timeout;
int timeoutx;
KScreenSaver()
{
SystemParametersInfo( SPI_GETSCREENSAVEACTIVE,
0,
&enabled,
0
);
enabledx = enabled;
g_objLogger.Log("KScreenSaver() - enabled=%u\n", enabled);
if (enabled)
Enable(FALSE);
SystemParametersInfo( SPI_GETSCREENSAVETIMEOUT,
0,
&timeout,
0
);
g_objLogger.Log("KScreenSaver() - timeout=%d\n", timeout);
timeoutx = timeout;
if (timeout)
SetTimeout(0);
}
~KScreenSaver()
{
Enable(0);
SetTimeout(timeout);
g_objLogger.Log("~KScreenSaver() - enabled=%u\n", enabled);
}
int GetTimeout() const
{
return timeout;
}
void SetTimeout(int timeout_)
{
if (timeoutx != timeout_)
{
g_objLogger.Log("KScreenSaver::SetTimeout - old=%d new=%d\n",
timeoutx, timeout_);
BOOL fx =
SystemParametersInfo( SPI_SETSCREENSAVETIMEOUT,
timeout_,
0,
SPIF_SENDWININICHANGE
);
timeoutx = timeout_;
}
}
void Enable(BOOL enable=TRUE)
{
g_objLogger.Log("KScreenSaver::Enable + enabled=%u; enable=%u\n",
enabledx, enable);
if (enabledx != enable)
{
BOOL fx =
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE,
enable,
0,
SPIF_SENDWININICHANGE
);
if (fx)
enabledx = enable;
}
g_objLogger.Log("KScreenSaver::Enable - enabled=%u; enable=%u\n",
enabledx, enable);
}
};

#if !defined( _DEBUG )
KScreenSaver g_objScreenSaver;
#endif

I didn't bother to remove the logger lines. It is enough to define a global
object. So it disables the screen saver when it starts and restores when it
stops.



.



Relevant Pages

  • Re: TS 2003 client timeout value.
    ... I am sorry it seems to has nothing to do with the GP settings. ... GP the timeout - nothing has changed. ... > Sounds like a password protected screen saver is running on the ... > applies to the users when they log on to the Terminal Server, ...
    (microsoft.public.windows.terminal_services)
  • Re: GPO to Lock workstations
    ... > Are you saying that the setting (in a GPO): ... > Hide Screen Saver tab: ... >> This can be done with group policy. ... >> user has a sensible timeout set on the screensaver. ...
    (microsoft.public.win2000.group_policy)
  • Re: "swiN: clock sio" process taking 75% CPU
    ... about 3/4 of the machine's CPU. ... or timeout()) or you have timeout handlers that are taking a very long time ... somewhere saying that the screen saver makes no attempt ... a machine for real work with the screen saver enabled ...
    (freebsd-hackers)
  • Re: GPO to Lock workstations
    ... Are you saying that the setting (in a GPO): ... Hide Screen Saver tab: Enabled ... > This can be done with group policy. ... > user has a sensible timeout set on the screensaver. ...
    (microsoft.public.win2000.group_policy)