| Option Explicit Private Const PROCESS_ALL_ACCESS = &H1F0FFF 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 Function TerminateProcess Lib "kernel32" _ (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Public Function EndShelledProcess(ShellReturnValue As Long) _ As Boolean 'PURPOSE: End a process started with VB's Shell Statement 'INPUT: Task ID returned by Shell 'RETURNS: True if succesful, false otherwise 'on error resume next Dim hInst As Long Dim hProcess As Long Dim lExitCode As Long Dim lRet As Long hInst = ShellReturnValue If hInst = 0 Then Exit Function 'Get handle to process hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0&, hInst) If hProcess <> 0 Then 'get exit code GetExitCodeProcess hProcess, lExitCode If lExitCode <> 0 Then 'bye-bye lRet = TerminateProcess(hProcess, lExitCode) EndShelledProcess = lRet > 0 End If End If End Function |
End an Application that was Started by the Shell F |
India web developer web development India | Freelance web development ecommerce web developer | Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design