I was wondering if I could start the screensaver through code. (better than setting it to one minute!)
Steve
Printable View
I was wondering if I could start the screensaver through code. (better than setting it to one minute!)
Steve
Try this:
Paste it to the declarations section of a module. You don't need any forms or any other modules for this to work.Code:Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_SYSCOMMAND As Long = &H112&
Public Const SC_SCREENSAVE As Long = &HF140&
Sub Main()
Dim hWnd&
On Error Resume Next
hWnd& = GetDesktopWindow()
Call SendMessage(hWnd&, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
End
End Sub
All the best,
------------------
- Chris
[email protected]
If it ain't broke - don't fix it :)