Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

Detect name(s) of running processes in WinNT

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

  • Detect name(s) of running processes in WinNT

    Can someone give me a tip how to list the 'process-image names'
    running on an NT workstation? (i.e. in Task Mgr - the
    'Processes' tab)

    I need to be able to detect whether an instance of my program
    is already running. It monitors the system in a time-delayed
    loop and has *no* dialog, hence it has *no* App Title to search
    for (!).

    Many TIA.

    William Fletcher

    ------------------

  • #2
    http://www.powerbasic.com/support/pb...ead.php?t=2521

    ps. but if you want to prevent double start, there is much simple way - createmutex
    Code:
    #compile exe
    #dim all
    #register none
    #include "win32api.inc"
    function pbmain()
       local hmutex as long, hdlg as long, prgname as asciiz * %max_path
       prgname = "any unique name" ' important
       hmutex = createmutex(byval %null, 0, prgname): _
          if hmutex = 0 then exit function ' error in mutex
       if getlasterror = %error_already_exists then _
          msgbox "already running": exit function
       dialog new hdlg, "first instance", , , 100, 100, %ws_sysmenu to hdlg
       dialog show modal hdlg
       closehandle hmutex ' possible to delete
    end function
    [this message has been edited by semen matusovski (edited december 13, 2000).]

    Comment


    • #3
      Works like a charm - thanks Semen!

      ------------------

      Comment

      Working...
      X