Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to run an .exe app from within a function

How to run an .exe app from within a function

Scheduled Pinned Locked Moved Visual Basic
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nitingonsalves
    wrote on last edited by
    #1

    Hi I was wondering how I would be able to run an .exe file from within a function. Thanks Nitin

    J 1 Reply Last reply
    0
    • N nitingonsalves

      Hi I was wondering how I would be able to run an .exe file from within a function. Thanks Nitin

      J Offline
      J Offline
      Jerome Conus
      wrote on last edited by
      #2

      You can use the Shell function : l_vRetVal = Shell(_your_exe_path_and_name", vbNormalFocus) This will asynchronously run the given .exe file. Have a look in the MSDN to understand the meaning of vbNormalFocus and to know the other possibilites. If you don't want to run it asynchronously (ie : you want the your function waits until the exe is finished), you'll have to create a process. If you need, I can give you more infos on that. Jerome

      R 1 Reply Last reply
      0
      • J Jerome Conus

        You can use the Shell function : l_vRetVal = Shell(_your_exe_path_and_name", vbNormalFocus) This will asynchronously run the given .exe file. Have a look in the MSDN to understand the meaning of vbNormalFocus and to know the other possibilites. If you don't want to run it asynchronously (ie : you want the your function waits until the exe is finished), you'll have to create a process. If you need, I can give you more infos on that. Jerome

        R Offline
        R Offline
        RichardGrimmer
        wrote on last edited by
        #3

        An even simpler (and apparently more thread-safe for some reason that someone once told me that I can't remember!) is to use ShellExecute function - use the API viewer to get the VB prototype "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups