Announcement

Collapse
No announcement yet.

Is there a way to stop a program launching twice?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a way to stop a program launching twice?

    Hi guys, is there any way of stopping the program from launching if it is already running? I'll explain a bit better:

    I have created a program which starts up from the CD (autorun), when that loads up there is a button to patch a program which resides on the C drive of the PC. However to patch it it needs the original program CD to be inserted into the CDROM. Once that is completed you need to reinsert the autorun CD and so that starts up again and end up with 2 sessions of the program.

    Is there any way of stopping it load itself twice?

  • #2
    Re: Is there a way to stop a program launching twice?

    In your apps On Initialize do a Window.Find to see if you app is running, if it is, then exit your app.

    %hWnd% = ""
    %hWnd% = Window.Find ("Your Applications Title here")
    IF (%hWnd% <> "" )
    Application.Exit
    END IF

    Comment


    • #3
      Re: Is there a way to stop a program launching twice?

      Thanks for the reply. Tried it and it sort of works.

      I have placed that command within my "Project Settings" - On Initialize.

      When the program loads up it checks a registry location for the installed path of a program and then asks the user if it is the correct path. That still comes up, however if the user clicks yes or no the program exits because it has found the other window. Am I placing the Window.find command in the wrong place?

      Comment


      • #4
        Re: Is there a way to stop a program launching twice?

        Worm, worked it out. My fault, forgot about a previous command which was running before the window.find.

        Thanks for your help.

        Comment


        • #5
          Re: Is there a way to stop a program launching twice?

          No problem.

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎