Delphi中对Dos命令的调用

procedure TForm1.SendmMSG(MessageStr: String);   //用于发送消息
var
  si : Tstartupinfo;
  pi : TProcessInformation;
begin
    MessageStr:='net send hostname '+MessageStr;

    if sendcount=-1 then
    begin
    FillChar(si,  SizeOf(StartUpInfo),  $00);
    si.dwFlags  :=  STARTF_USESHOWWINDOW;
    si.wShowWindow  :=  SW_Hide;
    if  CreateProcess(nil, PChar(MessageStr), nil, nil,False,
              IDLE_PRIORITY_CLASS, nil, nil, si,pi)  then
    begin
      CloseHandle(pi.hThread);
      CloseHandle(pi.hProcess);
    end else showmessage('sss');
    end else while not (teedit3.Text='0') do
    begin
      FillChar(si,  SizeOf(StartUpInfo),  $00);
    si.dwFlags  :=  STARTF_USESHOWWINDOW;
    si.wShowWindow  :=  SW_Hide;
    if  CreateProcess(nil, PChar(BatchFileName), nil, nil,False,
              IDLE_PRIORITY_CLASS, nil, nil, si,pi)  then
    begin
      CloseHandle(pi.hThread);
      CloseHandle(pi.hProcess);
    end else showmessage('sss');
      teedit3.Text:=inttostr(strtoint(trim(teedit3.Text))-1);
      form1.Update;
    end;
end; 

你可能感兴趣的:(Delphi,delphi,dos,class,string)