medleyj
August 20th, 2001, 10:16 AM
My vb project contains the following code:
public Function LaunchApp(byval DOS_String as string)
Dim sNull as string
Dim lngSuccess as Long
Dim strFileName as string
Dim mP_Info as PROCESS_INFORMATION
Dim mS_Info as STARTUPINFO
mS_Info.cb = len(mS_Info)
mS_Info.lpReserved = vbNull
mS_Info.dwFlags = STARTF_USESHOWWINDOW
mS_Info.wShowWindow = SW_SHOWNORMAL
mS_Info.cbReserved2 = 0
mS_Info.lpReserved2 = vbNull
strFileName = App.Path & "\"
' strFileName = modGetShortFileName.GetDOSPath(strFileName, true)
strFileName = strFileName & DOS_String
'Launch the application.
lngSuccess = CreateProcess(sNull, strFileName, 0&, 0&, _
1&, NORMAL_PRIORITY_CLASS, 0&, sNull, mS_Info, mP_Info)
End Function
My problem is this: if I pass in just the name of an executable, this works fine. But as soon as I try to add command line parameters nothing happens. It doesn't seam to make any difference whether I pass "param1, param2" or "param1,param2" or "param1 param2". I have even tried variations where the first parameter of the function call gets the app name and the second parameter gets the parameter string. No variation I have tried makes any difference. The weird thing is that I'm not even getting an error. Either I pass in just the name of an executable and it works, or I pass in an executable and a parameter list and I get nothing.
Does anybody know what I might be doing wrong?
Thanks in advance.
public Function LaunchApp(byval DOS_String as string)
Dim sNull as string
Dim lngSuccess as Long
Dim strFileName as string
Dim mP_Info as PROCESS_INFORMATION
Dim mS_Info as STARTUPINFO
mS_Info.cb = len(mS_Info)
mS_Info.lpReserved = vbNull
mS_Info.dwFlags = STARTF_USESHOWWINDOW
mS_Info.wShowWindow = SW_SHOWNORMAL
mS_Info.cbReserved2 = 0
mS_Info.lpReserved2 = vbNull
strFileName = App.Path & "\"
' strFileName = modGetShortFileName.GetDOSPath(strFileName, true)
strFileName = strFileName & DOS_String
'Launch the application.
lngSuccess = CreateProcess(sNull, strFileName, 0&, 0&, _
1&, NORMAL_PRIORITY_CLASS, 0&, sNull, mS_Info, mP_Info)
End Function
My problem is this: if I pass in just the name of an executable, this works fine. But as soon as I try to add command line parameters nothing happens. It doesn't seam to make any difference whether I pass "param1, param2" or "param1,param2" or "param1 param2". I have even tried variations where the first parameter of the function call gets the app name and the second parameter gets the parameter string. No variation I have tried makes any difference. The weird thing is that I'm not even getting an error. Either I pass in just the name of an executable and it works, or I pass in an executable and a parameter list and I get nothing.
Does anybody know what I might be doing wrong?
Thanks in advance.