记事本与计算器的调用
procedure TMain.N8Click(Sender: TObject);
var
OFile:String;
HWndCalculator:HWnd;
begin
HWndCalculator:=FindWindow(nil,'计算器');
if (HWndCalculator=0) then
begin
OFile:='calc.exe';
Shellexecute(handle,'Open',pchar(OFile),nil,pchar(ExtractFilePath(OFile)),SW_SHOWNORMAL);
end;
end;
procedure TMain.N9Click(Sender: TObject);
var
OFile:String;
HWndCalculator:HWnd;
begin
HWndCalculator:=FindWindow(nil,'记事本');
if (HWndCalculator=0) then
begin
OFile:='NOTEPAD.EXE';
Shellexecute(handle,'Open',pchar(OFile),nil,pchar(ExtractFilePath(OFile)),SW_SHOWNORMAL);
end;
end;