Search found 1376 matches

by jj2007
Jun 04, 2020 17:20
Forum: General
Topic: Why is it crashing?
Replies: 6
Views: 174

Re: Why is it crashing?

UEZ wrote:This is how it should look like
Beautiful - my compliments!
by jj2007
Jun 03, 2020 22:47
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

What I missed is the actual reason that the process may only run once. Is it to prevent data file or database corruption or some other reason? Are different users allowed to run instances at the same time? OP did not specify the reason but an obvious one is to prevent opening the same file twice, e...
by jj2007
Jun 03, 2020 2:26
Forum: Community Discussion
Topic: GW-BASIC is open source now
Replies: 22
Views: 934

Re: GW-BASIC is open source now

Some of the examples in the Masm32 SDK are over 20 years old. I can open them in my IDE, hit the "build" key and voilà, half a second later the executable's window is displayed in front of me. In contrast, I've yet to see a hello world proggie in C++ created with the previous (i.e. 2 years...
by jj2007
Jun 01, 2020 14:49
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

badidea wrote:A simple alternative:
Using the disk is not a simple alternative
by jj2007
Jun 01, 2020 8:55
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

I put a path If CreateSemaphore(0, 0, 1,"C:\Users\User\Desktop\shell.exe" ) . . . As deltarho noted, "The remainder of the name can contain any character except the backslash character " So it might be handier to use the full path of the executable. Nope. From MSDN, "The na...
by jj2007
Jun 01, 2020 0:50
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

deltarho[1859] wrote:
jj2007 wrote:You can also safely use Str(GetTickCount())
The random string needs to be designed once, used many times - GetTickCount is changing.
Oops, you are right. So it might be handier to use the full path of the executable.
by jj2007
May 31, 2020 22:08
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

deltarho[1859] wrote:Interestingly we can use a random string with the semaphore method
You can also safely use Str(GetTickCount())
by jj2007
May 31, 2020 12:24
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

UEZ wrote:The system closes the handle automatically when the process terminates. The semaphore object is destroyed when its last handle has been closed.
Thanks, that makes the difference: atoms are one of the rare objects that don't get destroyed by ExitProcess. Well done, SARG!
by jj2007
May 31, 2020 11:36
Forum: Community Discussion
Topic: Kogaion-forum (RqWork7)
Replies: 22
Views: 776

Re: Kogaion-forum (RqWork7)

Now it works, but it looks utterly confused. What exactly is the advantage of using this "IDE"?
by jj2007
May 30, 2020 21:40
Forum: Community Discussion
Topic: GW-BASIC is open source now
Replies: 22
Views: 934

Re: GW-BASIC is open source now

kankouhin7937 wrote:Even VB6 is open source
Are you sure?
by jj2007
May 30, 2020 21:37
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

SARG wrote:
jj2007 wrote:@Sarg: without ReleaseSemaphore, you risk having a different functionality
Just curious what risk ?
Here the semaphore is no more than a flag (not a counter) and it's destroyed when exiting properly the program or if there is a crash.
Can you post a complete example then?
by jj2007
May 30, 2020 13:18
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

deltarho[1859] wrote:I did not want to be told of a successful start so commented the second MessageBox
As UEZ noted, the MessageBox serves only to simulate the running program. When it finishes, the atom must be deleted.
by jj2007
May 30, 2020 8:36
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

Here is the Assembly version: Behave yourself, Jochen, the BASIC version is just fine. http://deltarho.org.uk/Downloads/wink.png Hey, young man, my last version looks more BASIC than yours http://deltarho.org.uk/Downloads/wink.png @Sarg: without ReleaseSemaphore, you risk having a different functio...
by jj2007
May 30, 2020 0:05
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

You are very kind, folks ;-) Here is the Assembly version: include \masm32\MasmBasic\MasmBasic.inc Init Let esi=CL$(0) ; use the executable name as a unique string .if rv(GlobalFindAtom, esi) MsgBox 0, Cat$(esi+" is already running"), "Sorry:", MB_OK or MB_TOPMOST .else push rv(G...
by jj2007
May 29, 2020 22:28
Forum: General
Topic: Start a program just one time
Replies: 59
Views: 1145

Re: Start a program just one time

#include "Windows.bi" Dim ItsMe as string=Command(0) If GlobalFindAtom(ItsMe) Then Messagebox Null, ItsMe+" is already running", "Sorry:", MB_IconWarning Or MB_Topmost else Dim IsRunning as short=GlobalAddAtom(ItsMe) Messagebox Null, ItsMe+" successfully started&q...

Go to advanced search