Call the program and get the program end information

xiaoxiao2021-03-06  61

procedure TForm1.Button3Click (Sender: TObject); var ExitCode:? cardinal ;? ExecInfo:? TShellExecuteInfo; begin ZeroMemory (@ ExecInfo, SizeOf (ExecInfo)) ;? with ExecInfo do begin ??? cbSize: = SizeOf (ExecInfo); ??? fmask: = see_mask_nocloseprocess; ??? lpverb: = 'open'; ??? // lpfile: = 'cmd.exe'; ??? compmgmt.msc / s ??? lpfile: = 'compmgmt.msc '; ??? lpparameters: = pchar (' / s'); ??? wnd: = self.handle; ??? nshow: = sw_shownormal ;? end;

? ShellExecuteEx (@ExecInfo) ;? GetExitCodeProcess (ExecInfo.hProcess, ExitCode) ;? while ExitCode = STILL_ACTIVE do begin ??? GetExitCodeProcess (ExecInfo.hProcess, ExitCode); ??? sleep (10); ??? Application.ProcessMessages ; end ;? showMessage ('success!') end;

转载请注明原文地址:https://www.9cbs.com/read-118259.html

New Post(0)