procedure TfrmMenu.BtnZaikoClick(Sender: TObject);
var
Arg : string;
SI : TStartupInfo;
PI : TProcessInformation;
begin
//指定されたファイルが存在しないならこの処理を終了
if not FileExists(ExeName) then
begin
Showmessage('プログラムが見つかりません');
Exit;
end;
// 引数の指定(今回はなし)
Arg := '';
// 呼び出し
GetStartupInfo(SI);
if not CreateProcess(PChar(ExeName), PChar(Arg), nil, nil,
False, CREATE_DEFAULT_ERROR_MODE,nil, nil, SI, PI) then
raise Exception.Create('Exec Error ' + IntToStr(GetLastError));
end;
|