preventing double application launch

Put Claude

Active Member
Licensed User
Hi,

Can 't find the way preventing a double application launch...
can you help me out...

Great forum guys, never get one like this, all my deep respects...

Put Claude Belgium
 

dzt

Active Member
Licensed User
@Erel
I think, he is talking about desktop.

@Put
You can check your Form Title, and if it exists then quit the app.
You can do that using my dzHWdesktop.dll (latest version) posted here http://www.basic4ppc.com/forum/showthread.php?t=384

B4X:
[FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT]Globals
[COLOR=#0000ff]End Sub
[/COLOR][COLOR=#0000ff] 
Sub [/COLOR]App_Start
  dzhw.New1

[COLOR=#0000ff]  If[/COLOR] dzhw.GetWindowHandle([COLOR=#800000]"null"[/COLOR], [COLOR=#800000]"Form Title"[/COLOR]) > [COLOR=#800080]0[/COLOR] [COLOR=#0000ff]Then
[/COLOR][COLOR=#0000ff]    AppClose
[/COLOR][COLOR=#0000ff]  End[/COLOR] [COLOR=#0000ff]If
[/COLOR]  Form1.Show
[COLOR=#0000ff]End Sub
[/COLOR]
 

Put Claude

Active Member
Licensed User
Hi,

Yes, did get 2 instance on Acer 300 WM5...
Noticed it when my gps-program counted every 2 seconds, I quit the program and get the underlying second same program that counts now every second, so... for some reason, the system did not prevent a second instance at same time.

dz,
did not find that in helpfile: dzhw.GetWindowHandle("null", "Form Title")

Made a little WF.exe in C (window find) that checks if my application already is open, so yes, bring it to front, and cancel the second launch.
My solution: Start this little exe with the shell function as first line in my application...

Put Claude Belgium
 
Last edited:
Top