start/stop screensaver?  
Author Message
nbrege





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

Is there a way that I can programatically start & stop the default screensaver I'm using VB2005 express running on WinXP. Thanks...

Visual Studio Express Editions35  
 
 
DMan1





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

'Path of screen saver file

Dim PathToSCR As String = "C:\Windows\System32\scrnsave.scr"

'start screensaver

Dim ScreenSaver As Process = Process.Start(PathToSCR)

'stop the screensaver

ScreenSaver.Kill()



 
 
nbrege





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

Thanks. That's exactly what I was looking for...
 
 
nbrege





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

OK, so suppose the screensaver was started by windows instead of my app.  How would I stop it, since I don't have a process name to kill & don't know the actual screensaver name
 
 
DMan1





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

Dim AllProcesses() As Process = Process.GetProcesses()

For Each p As Process In AllProcesses

If p.ProcessName.EndsWith("scr") Then

p.Kill()

End If

Next



 
 
nbrege





PostPosted: Visual Basic Express Edition, start/stop screensaver? Top

Thanks, again...