Results 1 to 3 of 3

Thread: I reaaly can use some help with "One instance"...

Hybrid View

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    I need to force only one instance of my Program. I have a proggie that on Form_Load it loads up another form which is placed into the Systray as an icon. I can't seem to force only one instance of my program without messing up my Icon in the systray. Currently the form that loads into the systray gets knocked out of the systray and soaks up massive system resources while is repeatedly flickers. How can a Force of "one instance", be correctly and cleanly accomplished?

    (Preferablly with the least amount of coding....The proggie is starting to get seriously cluttered with code.)

    I appreciate any time or efforts spent,
    Daniel christie

  2. #2
    Addicted Member Razzle's Avatar
    Join Date
    Jan 2000
    Location
    Berlin, Germany
    Posts
    161
    if i've understood you correctly you want to prevent that your app is started multiple times.
    you need a Module with the following code:

    Code:
    Sub Main()
     If App.PrevInstance = True Then End
     Form1.Show
    End Sub
    don't forget to set Sub Main as startup "form" in the Project preferences

    [Edited by Razzle on 05-06-2000 at 05:02 PM]
    Razzle
    ICQ#: 31429438
    What is the difference between a raven?
    -The legs. The length is equal, especially the right one.

  3. #3
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    You don't say which version you have, if Razzle's suggestion doesn't work with your version, check http://www.smithvoice.com/pvinstjp.htm for an alternate VB4/5/6 means.

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