|
-
Jan 16th, 2006, 10:43 AM
#1
Thread Starter
Addicted Member
Stopping screensaver via code
I need to be able to unload the screensaver via code
ie. same as moving the mouse or pressing a key
Any ideas?
Thanks
Another light-hearted post from Guru 
-
Jan 17th, 2006, 01:08 PM
#2
Re: Stopping screensaver via code
Is the screensave password protected?
-
Jan 17th, 2006, 01:29 PM
#3
Re: Stopping screensaver via code
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 17th, 2006, 01:32 PM
#4
Re: Stopping screensaver via code
 Originally Posted by RobDog888
Yes, it will help , providing there is no screensaver password.
-
Jan 17th, 2006, 01:58 PM
#5
-
Jan 17th, 2006, 02:05 PM
#6
Re: Stopping screensaver via code
 Originally Posted by manavo11
Couldn't you just do something like :
? 
Not if it has a password.
-
Jan 23rd, 2006, 09:50 AM
#7
Re: Stopping screensaver via code
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
Last edited by Dave Sell; Jan 23rd, 2006 at 10:16 AM.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Jan 23rd, 2006, 11:17 AM
#8
Re: Stopping screensaver via code
 Originally Posted by Dave Sell
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
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 deactivate:
VB Code:
rtn = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, False, ByVal 0&, 0)
To activate again
VB Code:
rtn = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, True, ByVal 0&, 0)
If succeds, return a value <> 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.
-
Jan 23rd, 2006, 11:53 AM
#9
Re: Stopping screensaver via code
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 24th, 2006, 05:31 PM
#10
Re: Stopping screensaver via code
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?
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Jan 24th, 2006, 05:43 PM
#11
Re: Stopping screensaver via code
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? You could just change it back after your program is done or loses?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 24th, 2006, 07:48 PM
#12
Re: Stopping screensaver via code
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.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Jan 24th, 2006, 07:52 PM
#13
Re: Stopping screensaver via code
 Originally Posted by Dave Sell
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?
But that should be done just after certain time without user input.
EDIT: Oh, i just see now RD post, sorry
Last edited by jcis; Jan 24th, 2006 at 09:11 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|