Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / How to avoid running program twice?

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 27th Oct 2010 22:11
Help! How to avoid running program twice?
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Oct 2010 22:17
Be careful not to double click it twice, I know its hard sometimes, but you've just got to learn.

Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 27th Oct 2010 22:21
Funny... But this really needs!
Bran flakes91093
15
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 28th Oct 2010 04:15
Do you mean only allowing one instance of your program to run at a single point in time?

“C++ : Where friends have access to your private members.”
-Gavin Russell Baker
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 28th Oct 2010 14:52
if so, i'm not sure if you can ask windows for a list of running applications, but easiet thing i can think of is creating a dummy file somewhere at startup and deleting it at ending, and when the application run while this file is there, it terminates

[url][/url]
Nothing's impossible, it's just a matter of time...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Oct 2010 15:25 Edited at: 28th Oct 2010 15:25
You can create a mutex that is unique to your program. Just create one with the initial owner flag set, then check the return value to make sure you have a handle, and then check GetLastError to ensure that you dodn't get ERROR_ALREADY_EXISTS.



Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 28th Oct 2010 15:28
Now that is neat!

Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 10th Nov 2010 23:04 Edited at: 10th Nov 2010 23:04
Thanks a lot! It works! But can I get a focus to my previous copy(exemplar)??? Need it much!
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 11th Nov 2010 00:16
Quote: "You can create a mutex"


What is a mutex? Never heard of it.
Anyway, good to know that this works. Could be handy sometimes...

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-06-30 10:45:55
Your offset time is: 2024-06-30 10:45:55