(Though I'm using VB.NET, I think I would have this same problem with VB6, and this forum gets so much more traffic...so I'm posting the question here...)
I guess I've never called ShellExecute() with command-line parameters, because I'm sure not able to do so successfully today.
I need to call an executable with a (possibly long) list of switches and parameters. Here's my code at the moment:
Public Const SW_SHOWDEFAULT As Integer = 10
Public 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 _
Dim nTemp As Long
Dim sEXEPath As String
Dim sFilePath As String
sEXEPath = "C:\dev\XML\XMILL\win32\XMILL.EXE"
sFilePath = "C:\~RexDB.XML"
nTemp = ShellExecute(0, "open", sEXEPath, sFilePath, "", SW_SHOWDEFAULT)
This .EXE always produces an output file at the path of the file it's provided ("sFilePath" above). The absence of this file tells me it's not working. It works just fine through the DOS window ("C:\dev\XML\XMILL\win32\XMILL.EXE C:\~RexDB.XML").
How do I call this from VB.NET? I've tried several different things, but no luck thus far.