Running Parallel Process or multi threading in VB using the shell command
Running Parallel Process or multi threading in VB using the shell command
API Declarations
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFFFFFF
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Rate Running Parallel Process or multi threading in VB using the shell command
(1(1 Vote))
Dim procID, pHnd, procID2, pHnd2
procID = Shell(ScanCmd$, vbMinimizedFocus) 'Process ID of the execution
procID2 = Shell(ScanCmd$, vbMinimizedFocus)
pHnd = OpenProcess(SYNCHRONIZE, 0, procID)
pHnd2 = OpenProcess(SYNCHRONIZE, 0, procID)
'If process1 and process2 is finish it would execute the next line
If pHnd <> 0 and pHnd2 <> 0 Then
Call WaitForSingleObject(pHnd, INFINITE)
Call WaitForSingleObject(pHnd2, INFINITE)
End If
Running Parallel Process or multi threading in VB using the shell command Comments
No comments yet — be the first to post one!
Post a Comment