VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Shell out to a 32-bit application and wait until task completes

by Anonymous (267 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 24th November 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Shell out to a 32-bit application and wait until task completes

API Declarations


Private Declare Function OpenProcess Lib "Kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "Kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Const STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400

Rate Shell out to a 32-bit application and wait until task completes




         Dim hProcess As Long
         Dim RetVal As Long
         'The next line launches JobToDo as icon,

         'captures process ID
         hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, Shell(JobToDo, 1))

         Do

             'Get the status of the process
             GetExitCodeProcess hProcess, RetVal

             'Sleep command recommended as well as DoEvents
             DoEvents: Sleep 100

         'Loop while the process is active
         Loop While RetVal = STILL_ACTIVE


End Sub

Download this snippet    Add to My Saved Code

Shell out to a 32-bit application and wait until task completes Comments

No comments have been posted about Shell out to a 32-bit application and wait until task completes. Why not be the first to post a comment about Shell out to a 32-bit application and wait until task completes.

Post your comment

Subject:
Message:
0/1000 characters