Click to See Complete Forum and Search --> : How to get window handle of Screensaver in NT


November 19th, 1999, 01:31 PM
I am working on closing a screensaver with a MScomm event. I've figured out how on win95, using enumwindows to get all hWnd windows then comparing classnames with WindowsScreenSaverClass using getclassname.

I've gotten information from a previous forum that the screensaver on NT is on a different desktop. How do I get at the other desktops? I'm not sure what the hwinsta is for the function EnumDesktops. Could someone offer some advice? Thanks in advance.

Alattas
September 20th, 2001, 04:11 AM
This is from the MSDN

* hwinsta: Handle to the window station whose desktops are to be enumerated.

U can get this handle using the function GetProcessWindowStation

*The GetProcessWindowStation function returns a handle to the window station associated with the calling process.

it has a void input
Have fun

Cimperiali
September 20th, 2001, 05:22 AM
'I have seen this question was posted in 1999, so maybe quester will not answer.
'In any case, this may be interesting:

'in a form
private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
me.AutoRedraw = true
me.print "Available Desktops:" + vbCrLf
EnumDesktops GetProcessWindowStation, AddressOf EnumDesktopProc, 0
End Sub
'in a module
Declare Function EnumDesktops Lib "user32" Alias "EnumDesktopsA" (byval hwinsta as Long, byval lpEnumFunc as Long, byval lParam as Long) as Long
Declare Function GetProcessWindowStation Lib "user32" () as Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst as Any, pSrc as Any, byval ByteLen as Long)
Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (byval lpString as Long) as Long
Function EnumDesktopProc(byval lpszDesktop as Long, byval lParam as Long) as Boolean
Dim Buffer as string
Buffer = Space(lstrlen(lpszDesktop))
CopyMemory Buffer, lpszDesktop, len(Buffer)
Form1.print Buffer
EnumDesktopProc = true
End Function





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater