Activate the Screensaver
This lesson will show you how to launch the screensaver with code. It's very simple and only takes a couple of lines of code to accomplish. The first part goes in a module.
Rate Activate the Screensaver
(6(6 Vote))
(General) (Declarations)
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 = &H112&
Public Const SC_SCREENSAVE = &HF140&
To actually activate the screensaver only takes one line of code. You can put it anywhere you want, but for my example, I'm placing it in the Click event of a command button.
Command1 Click
Private Sub Command1_Click()
Call SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, _
0&)
End Sub
Activate the Screensaver Comments
No comments yet — be the first to post one!
Post a Comment