
16.05.2011, 08:54
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure CreateProcessAndWait(CommandLine: String);
var
startupinfoa: STARTUPINFO;
processinformation: PROCESS_INFORMATION;
begin
ZeroMemory(@startupinfoa, SizeOf(STARTUPINFO));
startupinfoa.cb:=SizeOf(STARTUPINFO);
startupinfoa.dwFlags:=STARTF_USESHOWWINDOW;
startupinfoa.wShowWindow:=SW_SHOW;
Windows.CreateProcess(nil, PChar(CommandLine), nil, nil, False, 0, nil, nil, startupinfoa, processinformation);
WaitForSingleObject(processinformation.hProcess, INFINITE);
CloseHandle(processinformation.hProcess);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add(DateTimeToStr(Now));
CreateProcessAndWait('notepad.exe');
Memo1.Lines.Add(DateTimeToStr(Now));
end;
end.
__________________
Пишу программы за еду.
__________________
|