//
unit ads_FileXNWaitDetail; {Copyright(c)2016 Advanced Delphi Systems Richard Maley Advanced Delphi Systems 12613 Maidens Bower Drive Potomac, MD 20854 USA phone 301-840-1554 dickmaley@advdelphisys.com The code herein can be used or modified by anyone. Please retain references to Richard Maley at Advanced Delphi Systems. If you make improvements to the code please send your improvements to dickmaley@advdelphisys.com so that the entire Delphi community can benefit. All comments are welcome. } (*UnitIndex Master Index Implementation Section Download Units
Description: ads_FileXNWaitDetail.pas This unit contains the following routines.
CreateProcess GetExitCodeProcess WaitForSingleObject
*) interface const STARTF_USESHOWWINDOW = 1; kernel32 = 'kernel32.dll'; CREATE_NEW_CONSOLE = $00000010; NORMAL_PRIORITY_CLASS = $00000020; INFINITE = Cardinal($FFFFFFFF); { Infinite timeout } type PStartupInfo = ^TStartupInfo; _STARTUPINFOA = record cb : Cardinal; lpReserved : Pointer; lpDesktop : Pointer; lpTitle : Pointer; dwX : Cardinal; dwY : Cardinal; dwXSize : Cardinal; dwYSize : Cardinal; dwXCountChars : Cardinal; dwYCountChars : Cardinal; dwFillAttribute: Cardinal; dwFlags : Cardinal; wShowWindow : Word; cbReserved2 : Word; lpReserved2 : PByte; hStdInput : THandle; hStdOutput : THandle; hStdError : THandle; end; TStartupInfo = _STARTUPINFOA; STARTUPINFO = _STARTUPINFOA; PProcessInformation = ^TProcessInformation; _PROCESS_INFORMATION = record hProcess : THandle; hThread : THandle; dwProcessId: Cardinal; dwThreadId : Cardinal; end; TProcessInformation = _PROCESS_INFORMATION; PROCESS_INFORMATION = _PROCESS_INFORMATION; PSecurityAttributes = ^TSecurityAttributes; _SECURITY_ATTRIBUTES = record nLength : Cardinal; lpSecurityDescriptor: Pointer; bInheritHandle : Boolean; end; TSecurityAttributes = _SECURITY_ATTRIBUTES; SECURITY_ATTRIBUTES = _SECURITY_ATTRIBUTES; function CreateProcess( lpApplicationName : PChar; lpCommandLine : PChar; lpProcessAttributes : PSecurityAttributes; lpThreadAttributes : PSecurityAttributes; bInheritHandles : Boolean; dwCreationFlags : Cardinal; lpEnvironment : Pointer; lpCurrentDirectory : PChar; const lpStartupInfo : TStartupInfo; var lpProcessInformation: TProcessInformation ) : Boolean; stdcall; function WaitForSingleObject( hHandle : THandle; dwMilliseconds: Cardinal ) : Cardinal; stdcall; function GetExitCodeProcess( hProcess : THandle; var lpExitCode: Cardinal ) : Boolean; stdcall; implementation //Unit Description UnitIndex Master Index
function CreateProcess; external kernel32 name 'CreateProcessA'; //Unit Description UnitIndex Master Index
function WaitForSingleObject; external kernel32 name 'WaitForSingleObject'; //Unit Description UnitIndex Master Index
function GetExitCodeProcess; external kernel32 name 'GetExitCodeProcess'; end. //