How to uniquely identify a process?

0

01423481d

Hi all

The question is simple:
How can I find out if an executable is running apart from verifying
process name, path, program title etc which does not ensure uniqueness?
I think classid (GUID) could help but I dont know if it is the right
direction and how to achieve this. Any advise is welcomed!

Thanks
 
0

01423481d

(e-mail address removed) ¼g¹D¡G
Hi all

The question is simple:
How can I find out if an executable is running apart from verifying
process name, path, program title etc which does not ensure uniqueness?
I think classid (GUID) could help but I dont know if it is the right
direction and how to achieve this. Any advise is welcomed!

Thanks

OK I got it

Process.getType.GUID.toString()
 
T

Tom Shelton

Hi all

The question is simple:
How can I find out if an executable is running apart from verifying
process name, path, program title etc which does not ensure uniqueness?
I think classid (GUID) could help but I dont know if it is the right
direction and how to achieve this. Any advise is welcomed!

Thanks

This is generally done with a mutex.

public sub main
dim created as bool
dim instanceCheck as new mutex (true, "MY_UNIQUE_MUTEX_NAME",
created)

if created then ' we got the mutex
try
application.run (new form1())
finally
instanceCheck.ReleaseMutex () ' make sure we release this bad
boy
end try
else
' process already running
' i've been known to use WM_COPYDATA to send messages to prev
instances :)
end if

end sub

HTH,
Tom Shelton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top