12-16-2022, 02:54 PM
The GetDesktopWindow works flawlessly for me in Win11.
As you can see from the tiny little screenshot above, the value I get from GetDesktopWindow isn't the same as the &HFFFF which you were using. That could be the whole issue in a nutshell.
Code: (Select All)
' declare external libraries.
Declare Dynamic Library "user32"
Function SendMessageA%& (ByVal hWnd%&, Byval Msg~&, Byval wParam~%&, Byval lParam%&)
Function GetDesktopWindow%& ()
End Declare
' declare screen saver call constants
Const wm_syscommand = &H112&
Const sc_screensave = &HF140&
Sleep 2
Print GetDesktopWindow
Print &HFFFF&
Sleep
s%& = SendMessageA(GetDesktopWindow, wm_syscommand, sc_screensave, 0&)
As you can see from the tiny little screenshot above, the value I get from GetDesktopWindow isn't the same as the &HFFFF which you were using. That could be the whole issue in a nutshell.