- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 控制窗口显示隐藏
procedure ChangeAppWindow(const Handle: THandle; const SetAppWindow, RestoreVisibility: Boolean);
var
Style: Integer;
WasVisible, WasIconic: Boolean;
begin
Style := GetWindowLong(Handle, GWL_EXSTYLE);
if (SetAppWindow and (Style and WS_EX_APPWINDOW = 0)) or (not SetAppWindow and (Style and WS_EX_APPWINDOW = WS_EX_APPWINDOW)) then
begin
WasVisible := IsWindowVisible(Handle);
if WasVisible or WasIconic then
begin
ShowWindow(Handle, SW_HIDE);
end
else
begin
ShowWindow(Handle, SW_SHOW);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ChangeAppWindow(form1.Handle, False, False);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ChangeAppWindow(form1.Handle, True, True);
end;