CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2001
    Location
    New York, NY
    Posts
    8

    Open External Executable

    I'm trying to set up a simple VB progam that will give the user 3 options. 1&2) Open on of to Executable files 3)Exit
    I'm not sure if I should use an Open Statement, Run Command etc.
    Also, I need to determine whether the Application is already active and if it is, inform the user with a Message box.
    If anyone could give me a little help with this, It would be greatly appreciated.
    Thanks.




  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Open External Executable

    It may be useful the "shell" command, but it will run the executable asincronously, at it will require some works to keep track. if you're going to call Office applications, it will be better to use com (reference the library inside vb and create an istance of those programs). This is not fiew code, so it may be better to have a look to numerous example:
    Make a search here (look on top: forum index|FAQ|Edit Profile|...|Search|) for "WaitforSingleObject" and "Excel" or "Application" and read questions and answers.

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Feb 2001
    Posts
    19

    Re: Open External Executable

    To run the executeable you can use the Shell command. As for determining if the program is already running, I would be glad if someone told me a way that works with every 32bit windows version.

    hth,
    daniel


  4. #4
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Open External Executable

    I think the commonly accepted method for doing this is using the Shell() function to start the other applications.

    If you wrote the other applications being called by the first one, you can use App.PrevInstance property to determine if another copy of the application is already running, if not, you'll have to use some API Calls to try and find out if they're already running... I use the EnumWindows API.

    Hope this helps!
    DJ


  5. #5
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Open External Executable

    I use the EnumWindows API which works OK on 95 and 98... don't know about NT.

    DJ


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

Featured