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;

相关阅读 >>

Delphi firemonkey的屏幕分辨率hdpi、mdpi、ldpi的差别

Delphi winapi: flashwindow - 闪烁窗口

Delphi 2009 查看所有 unicode 字符

Delphi 处理图片(剪切,压缩)

Delphi xe6 android 查看电池信息

Delphi 指针入门知识

Delphi 用dll实现插件的简单演示

Delphi xe 编译开关-一套代码不同平台编译

Delphi getcurrentdir 获取当前文件夹

Delphi中对excel表格文件的导入和导出操作

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...