投稿日 | : 2003/04/21(Mon) 11:23 |
投稿者 | : まな |
Eメール | : |
URL | : |
タイトル | : 別EXEを起動した時に・・・ |
どうもこんにちわっ!
別EXEを起動するプログラムの質問です。CreateProcessを使用したのですが、
どうもうまくプログラムが起動しません。CloseHandleをする前までは無事に
起動出来てました。このCloseHandleに間違いはないように思えるのですが、
間違っていたら教えてください!お願いします♪
Dim udtProcInfo As PROCESS_INFORMATION
Dim udtStartInfo As STARTUPINFO
Dim lngret As Long
udtStartInfo.cb = LenB(udtStartInfo)
lngret = CreateProcess(vbNullString, "C:\DATA\Price.exe" _
& Space(1) & "13" & "," & name_id _
& "," & "1" & "," & "systemOracleDSN" _
& "," & "homeuser" & "," & "homeuser" _
, ByVal 0&, ByVal 0&, 1&, NORMAL_PRIORITY_CLASS _
, ByVal 0&, vbNullString, udtStartInfo, udtProcInfo)
Call TerminateProcess(udtProcInfo.hProcess, 0&)
Call CloseHandle(udtProcInfo.hThread)
Call CloseHandle(udtProcInfo.hProcess)
'------- モジュール --------
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Any, lpThreadAttributes As Any, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Public Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwAccess As Long, ByVal fInherit As Integer, ByVal hObject As Long) As Long
Public Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const SYNCHRONIZE = 1048576
Public Const NORMAL_PRIORITY_CLASS = &H20&
Public Const PROCESS_TERMINATE = &H1