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 get application currently activated

How to get application currently activated

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++helpquestion
4 Posts 3 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.
  • A Offline
    A Offline
    Ales Petric
    wrote on last edited by
    #1

    Would somebody help me please do something in c++ step by step ? I want to get info. of currently active application: pid and name By active i don't mean the same application that wants to know the info. Example: from my application i want to know if notepad is currently active and somebody is writing txt.. REPORT 1/we have wo running applications = myapp and notepad 2/alt tab to myapp 3/status report in my application = myapp is focused 4/alt tab to notepad 5/status report in my application = notepad is focused 6/writing text in notepad 7/status report in my application = notepad is focused 8/status report in my application = event key pressed

    T S 2 Replies Last reply
    0
    • A Ales Petric

      Would somebody help me please do something in c++ step by step ? I want to get info. of currently active application: pid and name By active i don't mean the same application that wants to know the info. Example: from my application i want to know if notepad is currently active and somebody is writing txt.. REPORT 1/we have wo running applications = myapp and notepad 2/alt tab to myapp 3/status report in my application = myapp is focused 4/alt tab to notepad 5/status report in my application = notepad is focused 6/writing text in notepad 7/status report in my application = notepad is focused 8/status report in my application = event key pressed

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      This may help: [GetForegroundWindow]for getting handle of application which currently have Keyboard focus [GetWindowText] retrieve the Caption Text associated with Windows handle [GetWindowModuleFileName] return with the path of application!

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta

      1 Reply Last reply
      0
      • A Ales Petric

        Would somebody help me please do something in c++ step by step ? I want to get info. of currently active application: pid and name By active i don't mean the same application that wants to know the info. Example: from my application i want to know if notepad is currently active and somebody is writing txt.. REPORT 1/we have wo running applications = myapp and notepad 2/alt tab to myapp 3/status report in my application = myapp is focused 4/alt tab to notepad 5/status report in my application = notepad is focused 6/writing text in notepad 7/status report in my application = notepad is focused 8/status report in my application = event key pressed

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

        I think u will have to use hooks. Try this link http://www.codeproject.com/dll/hooks.asp

        A 1 Reply Last reply
        0
        • S stolid_rock

          I think u will have to use hooks. Try this link http://www.codeproject.com/dll/hooks.asp

          A Offline
          A Offline
          Ales Petric
          wrote on last edited by
          #4

          thx maybe this would help.....just wait me to code some stuff and post reply my result thx again Always willing to participate in coding new projects. C++. Multimedia, graphics and hardware.

          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