by Lil Henson To (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 7th June 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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
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
No comments have been posted about Running Parallel Process or multi threading in VB using the shell command. Why not be the first to post a comment about Running Parallel Process or multi threading in VB using the shell command.