I am using this code, but it runs in the foreground when I want it to be hidden can anyone tell me the correct syntax to do this.


Dim CmdLine$

If Not IsMissing(CommandLine) Then
CmdLine$ = ToRun & " " & CommandLine
Else
CmdLine$ = ToRun
End If

Dim proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim Ret&
wShowWindow = sw_hide
' Initialize the STARTUPINFO structure:
Start.cb = Len(Start)

' Start the shelled application:
Ret& = CreateProcessA(0&, CmdLine$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, Start, proc)

' Wait for the shelled application to finish:
Ret& = WaitForSingleObject(proc.hProcess, INFINITE)
Ret& = CloseHandle(proc.hProcess)


Thanks.