CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    How to get window handle of Screensaver in NT

    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.


  2. #2
    Join Date
    Sep 2001
    Posts
    2

    Re: How to get window handle of Screensaver in NT


    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


  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: How to get window handle of Screensaver in NT


    '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: [email protected]
    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
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured