preventing double application launch

Discussion in 'Questions (Windows Mobile)' started by Put Claude, Oct 2, 2007.

  1. Put Claude

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The .Net CF does (suppose to) prevent more than single instance.
    How do you get more than one instance?
     
  3. dzt

    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

    Code:
    [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]
     
  4. Put Claude

    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: Oct 2, 2007
Loading...