
19.05.2008, 09:02
|
Новичок
|
|
Регистрация: 11.04.2008
Адрес: В городе-герой Минск
Сообщения: 69
Репутация: 10
|
|
Код:
unit Main;
interface
uses
ShellApi, Messages, Windows,
SysUtils, Classes, Controls, Forms, StdCtrls, Graphics, ExtCtrls ;
type
TMain = class(TForm)
procedure Button1Click(Sender: TObject);
private
public
end;
implementation
Procedure ExecuteWait(Programme: string);
var
ShExecInfo: TShellExecuteInfo;
begin
FillChar(ShExecInfo, SizeOf(ShExecInfo), 0);
with ShExecInfo do
begin
cbSize:=SizeOf(ShExecInfo);
fMask :=SEE_MASK_NOCLOSEPROCESS;
lpFile:=PChar(Programme);
lpVerb:='open';
nShow :=SW_SHOW;
end;
if ShellExecuteEx(@ShExecInfo)
then WaitForSingleObject(ShExecInfo.hProcess, INFINITE);
end;
end.
procedure TMain.Button1Click(Sender: TObject);
begin
ExecuteWait('notepad.exe');
//здесь уже прога закрылась и делай что хочешь
end;
ТЕГАМИ ПОЛЬЗУЙСЯ а то накажут
|