Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to get the HWND from the windows on the "locked screen"

how to get the HWND from the windows on the "locked screen"

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
11 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krzysztof Gorgolewski
    wrote on last edited by
    #1

    hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

    I D R S K 6 Replies Last reply
    0
    • K Krzysztof Gorgolewski

      hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      I would try using Spy++, which comes with visual studio (at least it did - I assume it still does with newer stuff than I have), and see if you can find your desired window. Maybe it has a special window class name you can look for? And even if it is the only application you can see, I bet there are a loads of top level windows you can't see. Most tray apps will have an invisible one for getting messages at the very least. Iain.

      S 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        I would try using Spy++, which comes with visual studio (at least it did - I assume it still does with newer stuff than I have), and see if you can find your desired window. Maybe it has a special window class name you can look for? And even if it is the only application you can see, I bet there are a loads of top level windows you can't see. Most tray apps will have an invisible one for getting messages at the very least. Iain.

        S Offline
        S Offline
        SandipG
        wrote on last edited by
        #3

        Hi Iain, How can we use SPY++ after the computer screen in locked?? Can you please elaborate.. I tried to get the window handle but no success :( Thanks!!

        Regards, Sandip.

        1 Reply Last reply
        0
        • K Krzysztof Gorgolewski

          hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Krzysztof Gorgolewski wrote:

          ...so first i tried FindWindow(NULL, "Computer Locked"), but nothing.

          What does that function return? If NULL, have you tried calling GetLastError()? Are you sure that is the exact name of the window being sought?

          "Love people and use things, not love things and use people." - Unknown

          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

          1 Reply Last reply
          0
          • K Krzysztof Gorgolewski

            hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

            R Offline
            R Offline
            Roger Stoltz
            wrote on last edited by
            #5

            Krzysztof Gorgolewski wrote:

            i'm trying to get the window handle from the only window, when my windows is locked.

            So you want to get a handle to the window that is displayed when the user session is locked... Why? In order to do what? :suss: From a technical aspect I doubt this is even possible, but here are my thoughts... From that screen you can switch user through "Fast User Switching", which means that you create or active another desktop. This suggests to me that this window doesn't even belong to the session your application is running in and this is probably also why ::FindWindow() cannot find the window. If you want to know when the session gets locked you can register for session notifications with WTSRegisterSessionNotification() and process the WM_WTSSESSION_CHANGE message.

            "It's supposed to be hard, otherwise anybody could do it!" - selfquote
            "High speed never compensates for wrong direction!" - unknown

            1 Reply Last reply
            0
            • K Krzysztof Gorgolewski

              hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

              S Offline
              S Offline
              SimonSays
              wrote on last edited by
              #6

              You pretty much don't. The security screen is on a different desktop (read up on Windows Desktop objects) which is completely inaccessible to normal code.

              1 Reply Last reply
              0
              • K Krzysztof Gorgolewski

                hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

                K Offline
                K Offline
                Krzysztof Gorgolewski
                wrote on last edited by
                #7

                thanks for your thoughts. hm... so it's not possible because of security reasons? not nice to hear... i already got the message, when the screen/computer is locked (after the lock i'm changing the wallpaper and additionally wanted to move the f§%*$ng ... ehm ... nice "computer locked" window). ok, GetLastError i will have to check later. and the thing with a different desktop was/is also in my mind. maybe it's possible to find/enumerate through the available desktops and have a look for my desired window (if the security allows it : ) so long

                K 1 Reply Last reply
                0
                • K Krzysztof Gorgolewski

                  thanks for your thoughts. hm... so it's not possible because of security reasons? not nice to hear... i already got the message, when the screen/computer is locked (after the lock i'm changing the wallpaper and additionally wanted to move the f§%*$ng ... ehm ... nice "computer locked" window). ok, GetLastError i will have to check later. and the thing with a different desktop was/is also in my mind. maybe it's possible to find/enumerate through the available desktops and have a look for my desired window (if the security allows it : ) so long

                  K Offline
                  K Offline
                  Krzysztof Gorgolewski
                  wrote on last edited by
                  #8

                  oh yes: http://msdn.microsoft.com/en-us/library/ms682573(VS.85).aspx => "... Applications cannot access the Winlogon desktop ..." maybe i can change the access rights for my "default" desktop/program somehow to get to this "winlogon" desktop's content?!? criss

                  1 Reply Last reply
                  0
                  • K Krzysztof Gorgolewski

                    hi there, i'm trying to get the window handle from the only window, when my windows is locked. it has the "Computer Locked" title, so first i tried FindWindow(NULL, "Computer Locked"), but nothing. then i tried GetWindow(GetDesktopWindow(), GW_HWNDFIRST), because it's the (hopefully) one and only active window on the locked screen. but nothing. and i also tried WindowFromPoint with the mid point of my screen, because the "computer locked" window is centered an the screen. but no luck at all. sooo, anyone an idea or hint, how to get this _hard to get_ window handle? regards ps: google is also not giving any useful results

                    K Offline
                    K Offline
                    Krzysztof Gorgolewski
                    wrote on last edited by
                    #9

                    one more thought in the morning: once i used an application called Active Desktop Calendar. and it was displaying its calendar/todo/etc also on the locked screen. soo that means, if this application is able to access the Winlogon desktop, why should i not be able? regards

                    S 1 Reply Last reply
                    0
                    • K Krzysztof Gorgolewski

                      one more thought in the morning: once i used an application called Active Desktop Calendar. and it was displaying its calendar/todo/etc also on the locked screen. soo that means, if this application is able to access the Winlogon desktop, why should i not be able? regards

                      S Offline
                      S Offline
                      SandipG
                      wrote on last edited by
                      #10

                      Does this[^] help?

                      Regards, Sandip.

                      K 1 Reply Last reply
                      0
                      • S SandipG

                        Does this[^] help?

                        Regards, Sandip.

                        K Offline
                        K Offline
                        Krzysztof Gorgolewski
                        wrote on last edited by
                        #11

                        still i didn't had time to try anything new, but i let you know. regards

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups