flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] Run Program only one instance?

Author
Thread Post new topic Reply to topic
ly47



Joined: 24 Sep 2010
Posts: 27
ly47
Hi
Some programs can be opened several times...
and some programs you can open only 1 window,if you try to open again
you will get your program activated.
And that what I need.
Every program I write can be opened multi windows.
How I have to code that my exe file will be opened only once ?
Thanks
ly


Description:
Filesize: 124.19 KB
Viewed: 827 Time(s)

multi win.jpg


Post 07 Oct 2019, 13:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17010
Location: In your JS exploiting you and your system
revolution
The usual method is to use a Mutex.

The first instance creates the Mutex. Each subsequent instance will fail to create the Mutex since it already exists.

Then you can send a message to the first instance to give it whatever information it might need from the command line.
Post 07 Oct 2019, 13:51
View user's profile Send private message Visit poster's website Reply with quote
ly47



Joined: 24 Sep 2010
Posts: 27
ly47
Hi
Thanks
But I do not know what is Mutex,
any simple short example please...
Thanks again
ly
Post 07 Oct 2019, 14:12
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17010
Location: In your JS exploiting you and your system
revolution
Post 07 Oct 2019, 14:50
View user's profile Send private message Visit poster's website Reply with quote
ly47



Joined: 24 Sep 2010
Posts: 27
ly47
Hi
Thanks
I have to learn this...
and it will take time
ly
Post 07 Oct 2019, 15:01
View user's profile Send private message Reply with quote
ly47



Joined: 24 Sep 2010
Posts: 27
ly47
Hi Again
Solved.
attached simple win template with CreateMutex
and it works.
ly


Description:
Download
Filename: TEMPLATE_mutex.ASM
Filesize: 2.42 KB
Downloaded: 75 Time(s)

Post 08 Oct 2019, 00:59
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 759
Location: Massachusetts, USA
bitshifter
Mutex will fail if program crashes before release of handle.
I use FindWindow() with class name and null window name...
Post 23 Oct 2019, 00:37
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.