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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Check Dektop Window is the current Active Window?.

How to Check Dektop Window is the current Active Window?.

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
5 Posts 2 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.
  • N Offline
    N Offline
    Nitheesh George
    wrote on last edited by
    #1

    Hi, I am doing application in which i want to know whether the Desktop window is the current active window or Not. How can i do this. Is GetForeGroundWindow() is a solution?. thanks Nitheesh.

    Jose Jo Martin http://www.simpletools.co.in

    D 1 Reply Last reply
    0
    • N Nitheesh George

      Hi, I am doing application in which i want to know whether the Desktop window is the current active window or Not. How can i do this. Is GetForeGroundWindow() is a solution?. thanks Nitheesh.

      Jose Jo Martin http://www.simpletools.co.in

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

      Have you tried:

      if (GetActiveWindow() == GetDesktopWindow())
      ...

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      N 1 Reply Last reply
      0
      • D David Crow

        Have you tried:

        if (GetActiveWindow() == GetDesktopWindow())
        ...

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        N Offline
        N Offline
        Nitheesh George
        wrote on last edited by
        #3

        Hi David, Thanks for your reply. I tried using the GetForeGroundWindow but that didn't work. thanks Nitheesh

        Jose Jo Martin http://www.simpletools.co.in

        D 1 Reply Last reply
        0
        • N Nitheesh George

          Hi David, Thanks for your reply. I tried using the GetForeGroundWindow but that didn't work. thanks Nitheesh

          Jose Jo Martin http://www.simpletools.co.in

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

          Assuming you meant GetForegroundWindow(), I don't recall suggesting it. Anyway, what does it return? Have you compared that window handle with those in Spy++?

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          N 1 Reply Last reply
          0
          • D David Crow

            Assuming you meant GetForegroundWindow(), I don't recall suggesting it. Anyway, what does it return? Have you compared that window handle with those in Spy++?

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            N Offline
            N Offline
            Nitheesh George
            wrote on last edited by
            #5

            Hi David, I tried by using GetActiveWindow() but MSDN says "The GetActiveWindow function retrieves the window handle to the active window attached to the calling thread's message queue." . So i am getting NULL when my application's window is not the current window. Do u have any suggestion?. thanks. Nitheesh

            Jose Jo Martin http://www.simpletools.co.in

            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