I need to be able to unload the screensaver via code
ie. same as moving the mouse or pressing a key
Any ideas?
Thanks
Printable View
I need to be able to unload the screensaver via code
ie. same as moving the mouse or pressing a key
Any ideas?
Thanks
Is the screensave password protected?
This should help - http://support.microsoft.com/default...en-us%3B315725
Yes, it will help :thumb: , providing there is no screensaver password. :DQuote:
Originally Posted by RobDog888
Couldn't you just do something like :
VB Code:
SendKeys "{ENTER}"
? :)
Not if it has a password.Quote:
Originally Posted by manavo11
Sorry for the thread hijack, but how can you prevent the screensaver from ever coming up (using code)?
For example, simply send a message of some sort every 14 minutes to Windows that represents a user input.
Thanks!
Dave
Quote:
Originally Posted by Dave Sell
To deactivate:VB Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long Const SPI_SETSCREENSAVEACTIVE = 17 Dim rtn As Long
To activate againVB Code:
rtn = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, False, ByVal 0&, 0)
If succeds, return a value <> 0.VB Code:
rtn = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, True, ByVal 0&, 0)
- Be sure to activate it again when you close your program, else it will remain inactive.
- I don't know if this works with password protected screensavers.
Doesnt matter if there is a password. This wil disable the screensaverfrom running. It will work even if they manually go in and set the screensaver again.
VB Code:
Option Explicit 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 Private Const SPI_GETSCREENSAVETIMEOUT As Long = 14 Private Const SPI_SETSCREENSAVETIMEOUT As Long = 15 Private Const SPI_GETSCREENSAVEACTIVE As Long = 16 Private Const SPI_SETSCREENSAVEACTIVE As Long = 17 Private Const SPIF_UPDATEINIFILE = &H1 Private Const SPIF_SENDWININICHANGE As Long = &H2 Private Sub Timer1_Timer() Dim lRet As Long Dim iDuration As Integer Dim bActive As Boolean SystemParametersInfo SPI_GETSCREENSAVEACTIVE, 0&, bActive, False If bActive <> 0 Then lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0&, Null, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) If lRet <> 0 Then Debug.Print "Stoped: " & lRet 'Change duration to 9999 Minutes SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, 599940, Null, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE 'Timer1.Enabled = False End If Else Debug.Print "Not Running: " & bActive End If End Sub
Disabling the screensaver is not the answer and not what I asked for. I want to "fool" the system into thinking there is user input every 14 minutes. No other solution will suffice.
To repeat: how do I fake some user input in order to prevent the screensaver from kicking in?
Thats what you get for hijacking the thread :Lol: Jk. ;)
Wouldnt moving the mouse using the POINTAPI Type and some APIs do the trick? If not maybe use the Keybd_event API to send a Shift keypress or move the mouse would suffice?
My changing the duration was not amusing? :D You could just change it back after your program is done or loses?
Any attempt to change the configuration is basically illegal due to overly oppressive network policies. However I thought I could skirt the issue by faking user input. I thought I might bundle this up into a utility.
What about sending just a little mouse movement with Mouse_Event, in a timer?Quote:
Originally Posted by Dave Sell
But that should be done just after certain time without user input.
EDIT: Oh, i just see now RD post, sorry :D