VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Starts a Program and waits for it to Terminate, Also works with DOS by monitoring the window for fi

Ilya Pokrovskiy  (1 Submission)   Miscellaneous   VB 6.0   Unknown Difficulty   Sun 4th February 2001   Mon 8th February 2021

Starts a Program and waits for it to Terminate, Also works with DOS by monitoring the window for finished. Works on all MS systems. All done

API Declarations


Private 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

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type

Private Const WAIT_OBJECT_0 = 0
Dim TerminateProc As Long

Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As Long, _
ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, _
ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, _
ByVal lpCurrentDriectory As String, _
ByRef lpStartupInfo As STARTUPINFO, _
ByRef lpProcessInformation As PROCESS_INFORMATION) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Declare Function EnumThreadWindows Lib "user32" (ByVal dwThreadId As Long, _
ByVal lpfn As Long, _
ByVal lParam As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, _
ByVal uExitCode As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long


Rate Starts a Program and waits for it to Terminate, Also works with DOS by monitoring the window for fi (1(1 Vote))
Starts a Program and waits for it to Terminate, Also works with DOS by monitoring the window for fi.bas

Starts a Program and waits for it to Terminate, Also works with DOS by monitoring the window for fi Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters