What is the VB 6 equivalent of Process.Start?

前端 未结 3 1412
星月不相逢
星月不相逢 2021-01-14 13:19

I am stuck on a really stuck with this one line. In vb.net this is easy, but how do I do this in vb6? Tried to search from google for few hours and got nothing. Feels almost

3条回答
  •  醉梦人生
    2021-01-14 14:15

    You can use ShellExecute for this:

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    ShellExecute 0, "open", App.Path & "\runme.exe", "-parameter1 -parameter2 -parameter3", vbNullString, vbNormalFocus 
    

    I have found that using Shell causes a delay in the calling program waiting for the return value, whereas ShellExecute does not.

提交回复
热议问题