function CreateSingleObject(FileName: string):Boolean;
var
s: TStartupinfo;
p: TProcessInformation;
begin
Result:=False;
FillChar(s, Sizeof(TStartupinfo), 0);
s.cb := Sizeof(TStartupinfo);
if CreateProcess(pChar(FileName), nil, nil, nil, False,
Normal_Priority_Class, nil, nil, s, p) then
begin
WaitforSingleObject(p.hProcess, INFINITE);
CloseHandle(p.hProcess);
Result:=True;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Hide;
CreateSingleObject('C:WindowsSystem32cmd.exe');
BringToFront;
Show;
end;