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 find if a process has active UI ?

How to find if a process has active UI ?

Scheduled Pinned Locked Moved C / C++ / MFC
designtutorialquestion
6 Posts 4 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.
  • D Offline
    D Offline
    dharani
    wrote on last edited by
    #1

    Hi all Our application has to kill OUTLOOK.exe if it runs only in background . Assuming we already have process id and handle to kill it with TerminateProcess , how to find if this outlook.exe has UI active or not ?? Any APIs please ...

    redindian

    _ S 2 Replies Last reply
    0
    • D dharani

      Hi all Our application has to kill OUTLOOK.exe if it runs only in background . Assuming we already have process id and handle to kill it with TerminateProcess , how to find if this outlook.exe has UI active or not ?? Any APIs please ...

      redindian

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Use EnumWindows to enumerate all open windows. Use GetWindowThreadProcessID on the window handle to get the process Id of the window. Compare with the process Id you already have. Now you can use TerminateProcess (or a better way) to kill outlook.

      «_Superman_»

      D 1 Reply Last reply
      0
      • _ _Superman_

        Use EnumWindows to enumerate all open windows. Use GetWindowThreadProcessID on the window handle to get the process Id of the window. Compare with the process Id you already have. Now you can use TerminateProcess (or a better way) to kill outlook.

        «_Superman_»

        D Offline
        D Offline
        dharani
        wrote on last edited by
        #3

        I am already aware of how to enumerate the processes and kill it . What I want to know is : To find if a process is running in background or running with UI ....

        redindian

        _ D 2 Replies Last reply
        0
        • D dharani

          I am already aware of how to enumerate the processes and kill it . What I want to know is : To find if a process is running in background or running with UI ....

          redindian

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          EnumWindows

          «_Superman_»

          1 Reply Last reply
          0
          • D dharani

            Hi all Our application has to kill OUTLOOK.exe if it runs only in background . Assuming we already have process id and handle to kill it with TerminateProcess , how to find if this outlook.exe has UI active or not ?? Any APIs please ...

            redindian

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            dharani wrote:

            runs only in background

            Define what you mean by that.

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            1 Reply Last reply
            0
            • D dharani

              I am already aware of how to enumerate the processes and kill it . What I want to know is : To find if a process is running in background or running with UI ....

              redindian

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

              dharani wrote:

              What I want to know is : To find if a process is running in background or running with UI ....

              You may want to check out functions like IsWindowVisible(), IsWindowIconic(), SendMessageTimeout(hWnd, WM_NULL, ...), and GetForegroundWindow().

              "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

              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