Results 1 to 13 of 13

Thread: prevent multiple executions of same vb app

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Location
    Princeton NJ
    Posts
    16

    prevent multiple executions of same vb app

    I would like to prevent a user from starting up an other 'instance' of a vb application when clicking on the desktop icon if that application is already open on the desktop. How do I go about doing this? Thanks in advance for your help!

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    use App.PrevInstance..
    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. If App.PrevInstance = True Then
    4.     MsgBox "Only 1 instance!", vbCritical
    5.     End
    6. End If
    7.  
    8. End Sub

  3. #3
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    HA... DON'T USE THE END STATEMENT. I would have though you would have figured that out by now chris. Always do this
    VB Code:
    1. dim f as form
    2. for each form in forms
    3. unload f
    4. set f = nothing
    5. next f
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  4. #4
    Originally posted by Skitchen8
    HA... DON'T USE THE END STATEMENT.[/Highlight]
    I was about to say that.

  5. #5
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    lol
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Bollocks to it. I can't be arsed to type a load of For Each Frm In Forms crap in a ****ing demo. Don't be so damn pedantic

  7. #7
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    damn, i was kidding
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  8. #8
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Maybe you were, but don't ***** at me for using End...

    You app has only got chance to open 1 form if using that cod, so it's fine just to put Unload Me anyway...

  9. #9
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    ok... ok, we weren't bitching at you we were suggesting to Laura Moloney to use that code because it will free up the memory used by your app
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Dec 2000
    Location
    Princeton NJ
    Posts
    16
    I thank you all for jumping in and not only answering my original question so quickly, but also remind me of good programming techniques, something I find useful to be reminded of from time to time. Plus the added bonus was that in my code, I was unloading forms individually, so the 'shortcut' shown here is very helpful! I also have to say I enjoyed your playful(?) bickering. KUDOS to all of you.................

  11. #11
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    yes, our bickering is always enjoyable to watch....
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  12. #12
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Originally posted by Laura Moloney
    I also have to say I enjoyed your playful(?) bickering. KUDOS to all of you.................
    We all love each other really

  13. #13
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    NO CHRIS, I THOUGHT I TOLD YOU I WASN'T GAY ANYMORE... LOL j/k i love you too
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

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