Announcement

Collapse
No announcement yet.

Can one DOS process determine if another DOS process is running?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can one DOS process determine if another DOS process is running?

    If it can, how is it done?

    I apologize for deleteing my first topic of this question, but I
    had decided that I would look through Ralf's Interrupt Lists in the
    INT 21 sections to see if there was something there. I gave up after
    looking through 2 lists ( ), and am now looking for a
    "quick and easy" answer.

    Thanks for any replies.


    ------------------
    Clay C. Clear
    mailto:[email protected][email protected]</A>

    #2
    If you are running under Windows 95 or better, then the easiest way is to create a small Windows console app (ie, using PB/CC) that acts as a launcher of the DOS app. This will work on everything from Windows 95 through to Windows XP.

    This makes it easy to use the FindWindow() API function to detect an existing instance. The app can then either switch that instance into the foreground, or launch a new instance.

    If the PB/CC console application launches the DOS app with a synchronous SHELL (rather than the asynchronous SHELL function) then another strategy can be employed... the console app can create a "Mutex" object which is (briefly) is a slightly more reliable way of detecting a running instance of a program.

    If you own PB/CC already, you'll be away laughing with this little project... just search these forums for "CreateMutex" and you'll find PB/CC and PB/Win code that uses a mutex to detect an existing instance of an app.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎