|
-
Sep 19th, 2002, 02:03 PM
#1
Thread Starter
Hyperactive Member
Detect previous instances (not App.PrevInstance)
How can my application know if there are any previous instances of this application running, and know when they have terminated.
I want my program to be able to sit and wait until any previous instances of itself has terminated, before displaying a form. So App.PrevInstance is no good because it does not refresh.
The title of the windows in this application will not be constant, the only thing I will know for sure is the path to, and name of the .exe file.
So basically;
Is there some way I can use to determine if windows is running any instances of an executable, that's not the current instance..
Thanks
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
-
Sep 19th, 2002, 02:43 PM
#2
Fanatic Member
On start up write something in the registry which says that 1st instance is running and check this registry before loading the new instance. On exit of 1st instance delete the registry data.
Kinjal
-
Sep 19th, 2002, 02:53 PM
#3
Thread Starter
Hyperactive Member
That would work for just 2 instances, but I plan on having many instances (variable) and some may show immediately, while some may have to wait until the others are closed (base on arguments passed to the exe)
I think what I'll end up doing is that each time an instance as opened, I will write it's ProcessID to a file.
When the instance is closed, I will remove it.
Other instances that need to wait, will check if the other instances are running by attempting to OpenProcess on those IDs.
It seems pretty messy to me but right now that's the best I can come up with...
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|