在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
procedure TForm1.Button1Click(Sender: TObject); var SEInfo: TShellExecuteInfo; ExitCode: DWORD; ExecuteFile, ParamString, StartInString: string; begin ExecuteFile := 'c:\Windows\system32\Calc.exe'; FillChar(SEInfo, SizeOf(SEInfo), #0); SEInfo.cbSize := SizeOf(TShellExecuteInfo); with SEInfo do begin fMask := SEE_MASK_NOCLOSEPROCESS; Wnd := Application.Handle; lpFile := PChar(ExecuteFile); //ParamString can contain the application parameters // lpParameters := PChar(ParamString); //StartInString specifies the name of the working directory.if ommited, the current directory is used. // lpDirectory := PChar(StartInString); nShow := SW_SHOWNORMAL; end; if ShellExecuteEx(@SEInfo) then begin repeat Application.ProcessMessages; GetExitCodeProcess(SEInfo.hProcess, ExitCode); if ExitCode = STILL_ACTIVE then Sleep(500); until (ExitCode <> STILL_ACTIVE) or Application.Terminated; ShowMessage('Calculator terminated'); end else ShowMessage('Error starting Calc!'); end; |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论