Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2003
    Location
    Mumbai, India
    Posts
    7

    Red face Unanswered: Problem with the exe i create

    Hi. Actually i am almost done with my VB project, still have some problems. When i create an exe file, i am able to open any number of instances of my application. But i want only one instance.

    So is there any code which will open the existing one instead of opening a new one. Some code which will disable more than 1 instance of the application. Please help me.

    Thank you.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Problem with the exe i create

    Use App.PrevInstance to see if a previous instance is already running.

    Private Sub Form_Load()
    ' See if there is already and instance.
    If App.PrevInstance Then
    ' Activate the previous instance
    AppActivate App.Title

    ' Send a key (here SHIFT-key) to set the
    ' form from the previous instance to the
    ' top of the screen.
    SendKeys "+", True

    ' Terminate the new instance
    Unload Me
    End If
    End Sub
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Dec 2003
    Location
    Mumbai, India
    Posts
    7

    Re: Problem with the exe i create

    Thank you. It did work in the sense it doesnt open a second instance, but it shows an error saying

    Runtime error 364
    Object was unloaded

    What should i do now? If u can tell me, plz do. For your information i wrote it in the splash scrren. I hope thats ok. Anyways Thanx a lot.

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Problem with the exe i create

    Try putting the code in the activate event instead of the load event. Does that help?
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  5. #5
    Join Date
    Dec 2003
    Location
    Mumbai, India
    Posts
    7

    Thumbs up Re: Problem with the exe i create

    Thanx a lot. Writing it in the activate event worked fine without errors. Really.... thank you very much.
    -Swaroopa.

Posting Permissions

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