|
-
May 11th, 2001, 03:59 AM
#1
Thread Starter
Junior Member
How to launch exe under W2K & W98 other tan with CreateProcess API or Shell func ?
I have an application (EXE file) that perfectly works under NT when I launch it with the API CreateProcess :
Public Function ExecCmd(cmdline As String, intWindowDisplay As Integer)
'Public Function ExecCmd(cmdline As String)
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim lReturndVal As Long
' Initialize the STARTUPINFO structure:
start.cb = Len(start)
start.dwFlags = start.dwFlags + STARTF_USESHOWWINDOW ' 1 = Bit positon of STARTF_USESHOWWINDOW
start.wShowWindow = intWindowDisplay ' Gives the way the window is displayed
' Start the shelled application:
lReturndVal = CreateProcessA(vbNullString, cmdline, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, _
vbNullString, start, proc)
' Wait for the shelled application to finish:
lReturndVal = WaitForSingleObject(proc.hProcess, INFINITE)
Call GetExitCodeProcess(proc.hProcess, lReturndVal)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
ExecCmd = lReturndVal
End Function
When I execute the same function under W2K or W98, the EXE does not work as it should.
Nevetheless, when I launch the EXE in W2K or W98 command line (Execute operation in startup menu), the EXE works properly !
Where could be the problem ?
Is there something to modify in the Function above ?
Thank you all for your answers.
she
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|