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. Determine if an exe is running or not

Determine if an exe is running or not

Scheduled Pinned Locked Moved C / C++ / MFC
comsysadminregexquestion
4 Posts 4 Posters 1 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
    act_x
    wrote on last edited by
    #1

    1 )I am implementing a component that receives an event , which needs to launch an exe However , I do not want to launch the exe if it is already running . Is there a way to determinie if the exe is currently running ? 2)Typically there are applications that are launched the first time when an event occurs . Say Windows media player is launched when i connect my music player However I would want to understand how these applications get notified when subsequent events ( non-first time events ) occur ? Is there a standard pattern to follow ? I was thinking, more on the lines of the App ( such as Windows Media player) that acts as a client to a Com Server ( which receives the notifications) , however the non first time notifications would be conveyed via a callback ( registered during initialization of the EXE ) . Ideas are welcome Thanks

    Engineering is the effort !

    D C L 3 Replies Last reply
    0
    • A act_x

      1 )I am implementing a component that receives an event , which needs to launch an exe However , I do not want to launch the exe if it is already running . Is there a way to determinie if the exe is currently running ? 2)Typically there are applications that are launched the first time when an event occurs . Say Windows media player is launched when i connect my music player However I would want to understand how these applications get notified when subsequent events ( non-first time events ) occur ? Is there a standard pattern to follow ? I was thinking, more on the lines of the App ( such as Windows Media player) that acts as a client to a Com Server ( which receives the notifications) , however the non first time notifications would be conveyed via a callback ( registered during initialization of the EXE ) . Ideas are welcome Thanks

      Engineering is the effort !

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

      act_x wrote:

      2)Typically there are applications that are launched the first time when an event occurs . Say Windows media player is launched when i connect my music player However I would want to understand how these applications get notified when subsequent events ( non-first time events ) occur ? Is there a standard pattern to follow ?

      WMP has code in it that checks to see if it is already running.

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • A act_x

        1 )I am implementing a component that receives an event , which needs to launch an exe However , I do not want to launch the exe if it is already running . Is there a way to determinie if the exe is currently running ? 2)Typically there are applications that are launched the first time when an event occurs . Say Windows media player is launched when i connect my music player However I would want to understand how these applications get notified when subsequent events ( non-first time events ) occur ? Is there a standard pattern to follow ? I was thinking, more on the lines of the App ( such as Windows Media player) that acts as a client to a Com Server ( which receives the notifications) , however the non first time notifications would be conveyed via a callback ( registered during initialization of the EXE ) . Ideas are welcome Thanks

        Engineering is the effort !

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        Further to David's comments on the application doing the checking for this, try a search for the term 'single instance' in the articles. Here's two articles that I'd recommend; 1). MFC and C++[^] 2). Managed .Net[^]. :)

        Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

        1 Reply Last reply
        0
        • A act_x

          1 )I am implementing a component that receives an event , which needs to launch an exe However , I do not want to launch the exe if it is already running . Is there a way to determinie if the exe is currently running ? 2)Typically there are applications that are launched the first time when an event occurs . Say Windows media player is launched when i connect my music player However I would want to understand how these applications get notified when subsequent events ( non-first time events ) occur ? Is there a standard pattern to follow ? I was thinking, more on the lines of the App ( such as Windows Media player) that acts as a client to a Com Server ( which receives the notifications) , however the non first time notifications would be conveyed via a callback ( registered during initialization of the EXE ) . Ideas are welcome Thanks

          Engineering is the effort !

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4
          1. When a New Device (like your music player) is plugged in, a Window Message ( WM_DEVICECHANGE ) is sent to all the resident windows... All you need to do is create a resident application with a hidden window...The window will recieve A WM_DEVICECHANGE Message...this is where you detect whether it's a viable device... There's also a "RegisterDeviceNotification" (though, i'm not familiar with it...) I'm not sure if this was what you were expecting? Is there any specfic event you want to "listen" to?

          My First Article : KitKat - A Very Simple Pseudo-RootKit (unedited)

          modified on Thursday, February 21, 2008 9:35 AM

          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