Hi all,

The code posted here before for starting the screensaver doesn't work!

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&

Function gf_StartScreenSaver() As Boolean
Dim hWnd&
On Error Resume Next
hWnd& = GetDesktopWindow()
Call SendMessage(hWnd&, WM_SYSCOMMAND, SC_SCREENSAVE, 0&)
gf_StartScreenSaver = (Err.Number = 0)
End Function

It can be found at http://www.vb-world.net/tips/tip146.html. I even followed the suggested correction by John Ryan in the feedback bit, with no effect.

It complains that GetDeskTopWindow() is not defined as a function. I can see why, but what is GetDeskTopWindow and why is it not included in the code sample by John Percival?

I intend using it as a simple way to lock my PC when I'm not using it (with the screensaver password), if I could get it to work!

Any ideas...Thanks guys

- Chris