Results 1 to 3 of 3

Thread: How can I check for my running program instance?

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    12

    How can I check for my running program instance?

    How can I check for my running program instance? Lets say I am running program prog1.exe, If I run it again, I want to have a messaga saying that the program is already running, How can Chech for this. Any hint is appretiated. Thanks.
    hajar

  2. #2
    Si_the_geek
    Guest
    if app.previnstance then
    msgbox "Already running!"
    end
    end if

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    There might be occasions when you do want to allow multiple instances of your program, but would like to keep track of how many are running at once. If so, you can use this:
    VB Code:
    1. Dim Response As Variant
    2. If App.PrevInstance = True Then
    3.    Response = MsgBox("Your program is already running.   Do you wish to open a second instance?", vbYesNo + vbQuestion, "Already Running")
    4.       If Response = vbNo Then
    5.          End
    6.       End If
    7. End If
    8. 'insert code to log a new instance and let the program continue

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width