参考例子:
procedure TForm1.Timer1Timer(Sender: TObject);
var
Site:string;
lpStartupInfo: STARTUPINFO;
lpProcessInfo: PROCESS_INFORMATION;
lpExitCode:cardinal;
begin
if (Curr=Memo1.Lines.Count) then Curr:=0;
Site:=Memo1.lines[Curr];
if (WinHandle<>0) then
Begin
GetExitCodeProcess(Winhandle,lpexitCode);
TerminateProcess(Winhandle,lpexitcode);
//PostMessage(WinHandle,WM_SYSCOMMAND,SC_CLOSE,0);
End;
Site:='C:\Program Files\Internet Explorer\IExplore '+Site;
GetStartupInfo(lpStartupInfo);
CreateProcess(nil,pchar(Site),nil,nil,True,CREATE_NEW_PROCESS_GROUP,nil,nil,lpStartupInfo,lpProcessInfo);