Hi people
I am trying to allow the user to launch the Windows Screen Saver by clicking on a button. I have the following code:
But get the error:Code:Option Explicit On Public Class Form1 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 Const WM_SYSCOMMAND = &H112& Const SC_SCREENSAVE = &HF140& Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SendMessage(Me.hwnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0&) End Sub End Class
any ideas why?Error 1 'hwnd' is not a member of 'LaunchScreensaverTest.Form1'.
Thanks![]()




Reply With Quote