--
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
"J. Shrimp, Jr." <jumbo_...@hotmail.com> wrote in message
news:110o348...@corp.supernews.com...
: IT department has enabled a screen saver that inititates 15
:
:
Try keybd_event or Sendinput to the desktop ?
--
Regards, Frank
{
/* get cursor position and move it */
btoggle=!btoggle;
GetCursorPos(&ptcursor);
if (btoggle)
SetCursorPos(ptcursor.x+1,ptcursor.y+1);
else
SetCursorPos(ptcursor.x-1,ptcursor.y-1);
}
A quick check of the win32 API help file shows the GetCursorPos and
SetCursorPos calls are still with us in win32.
--
Best regards,
Kyle
"J. Shrimp, Jr." <jumbo_...@hotmail.com> wrote in message
news:110o348...@corp.supernews.com...
Public Function SetTimeOut(ByVal textin As String) As Long
Dim lng1 As Long
Dim inparam As Long
Dim outparam As Long
outparam = Val(textin) * 60
inparam = outparam
lng1 = SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, inparam, _
outparam, SPIF_UPDATEINIFILE)
If lng1 <> 0 Then
SetTimeOut = outparam
Else
SetTimeOut = 0
End If
End Function
Here are the declares....
Private Const SPI_GETSCREENSAVETIMEOUT As Long = 14
Private Const SPI_SETSCREENSAVETIMEOUT As Long = 15
Private Const SPIF_SENDWININICHANGE As Long = &H2
Private Const SPIF_SENDCHANGE As Long = SPIF_SENDWININICHANGE
Private Const SPIF_UPDATEINIFILE As Long = &H1
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" ( _
ByVal uAction As Long, _
ByVal uParam As Long, _
ByRef lpvParam As Any, _
ByVal fuWinIni As Long) As Long
The SystemParametersInfo API will allow you to reset the time on the
ScreenSaver and stretch it out to whatever you want. I believe a "0"
will shut off the screensaver (but you have to confirm that).
HTH,
Barry
bceggersATcomcastDOTnet
For 2K+ you may also want to look at the SetThreadExecutionState()
API. It seems to be the ticket to switch off screen and power saves.
There was also a trappable (would require subclassing the main form)
broadcast message i thought, but can't put a finger on it.
>We have a similar problem but worked a different solution. Look at
>the following function....
>
<snip>
--
Regards, Frank
The msdn help says...
"This function does not stop the screen saver from executing either."
for this API call. Is the help file in error (again!!)?
I guess it would prevent poweroff/sleep/hibernation but not the
screensaver ??
bceggersATcomcastDOTnet
>Hi,
>
>The msdn help says...
>"This function does not stop the screen saver from executing either."
>
Huh, my MSDN doesn't say that ? Didn't check the online one yet.
>for this API call. Is the help file in error (again!!)?
>
Probably more like ambiguous. Again. :)
>I guess it would prevent poweroff/sleep/hibernation but not the
>screensaver ??
>
This is what mine says :
ES_DISPLAY_REQUIRED - Informs the system that the thread is performing
some operation that is not normally detected as display activity by
the system.
.....
Calling SetThreadExecutionState with ES_DISPLAY_REQUIRED prevents the
system from turning off the display by resetting the display idle
timer. Calling SetThreadExecutionState without ES_CONTINUOUS simply
resets the idle timer; to keep the display or system in the working
state, the thread must call SetThreadExecutionState periodically.
Note i haven't tested this. I just remembered the thread and happened
to stumble over it, so i thought it's worth a shot to bring attention
to it.
>
>On Mon, 14 Feb 2005 09:05:40 +1100, fa...@xxxxoptushome.com.au (Frank
>Adam) wrote:
>
>>On Sun, 13 Feb 2005 10:56:04 -0500, Barry <bceg...@castcom.com>
>>wrote:
>>
>>For 2K+ you may also want to look at the SetThreadExecutionState()
>>API. It seems to be the ticket to switch off screen and power saves.
>>There was also a trappable (would require subclassing the main form)
>>broadcast message i thought, but can't put a finger on it.
>>
>>>We have a similar problem but worked a different solution. Look at
>>>the following function....
>>>
>><snip>
>
>bceggersATcomcastDOTnet
--
Regards, Frank