procedure TForm1.Button1Click(Sender: TObject); var hh: THandle; begin hh := FindWindow(nil,'计算器'); if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null'; //SendMessage(hh, WM_ACTIVATE, 1, 1); //SendMessage(hh, WM_ACTIVATEAPP, 0, 0); ShowWindow(hh, SW_HIDE); //SendMessage(hh, wm) //if IsIconic(hh) then ShowWindow(hh, SW_RESTORE) //else //hh := GetWindow(hh, GW_OWNER); //SetActiveWindow(hh); end;
procedure TForm1.Button2Click(Sender: TObject); var hh: THandle; begin hh := FindWindow(nil,'计算器'); if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null'; SetActiveWindow(hh); SetForegroundWindow(hh); end;
procedure TForm1.Button3Click(Sender: TObject); var hh: THandle; begin hh := FindWindow(nil,'计算器'); if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null'; if IsIconic(hh) then ShowWindow(hh, SW_RESTORE) else SetForegroundWindow(hh); end;
不知道行不行!!!!!
var
hh: THandle;
begin
hh := FindWindow(nil,'计算器');
if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null';
//SendMessage(hh, WM_ACTIVATE, 1, 1);
//SendMessage(hh, WM_ACTIVATEAPP, 0, 0);
ShowWindow(hh, SW_HIDE);
//SendMessage(hh, wm)
//if IsIconic(hh) then
ShowWindow(hh, SW_RESTORE)
//else
//hh := GetWindow(hh, GW_OWNER);
//SetActiveWindow(hh);
end;
var
hh: THandle;
begin
hh := FindWindow(nil,'计算器');
if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null';
SetActiveWindow(hh);
SetForegroundWindow(hh);
end;
var
hh: THandle;
begin
hh := FindWindow(nil,'计算器');
if hh = 0 then Self.Caption := FormatDateTime('HHMMSS', Now) + 'null';
if IsIconic(hh) then
ShowWindow(hh, SW_RESTORE)
else
SetForegroundWindow(hh);
end;