delphi 单击最小化按钮隐藏单击托盘显示


本文整理自网络,侵删。

 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    TrayIcon1: TTrayIcon;
    procedure TrayIcon1Click(Sender: TObject);
  private
    procedure OnMinsize(var msg: twmsyscommand);
    message wm_syscommand;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.OnMinsize(var msg: twmsyscommand);
begin
  if msg.CmdType = SC_MINIMIZE then
  begin // 此处添加对最小化事件的处理过程
    Hide();
    msg.CmdType := SC_DEFAULT;
  end;
  inherited;
end;

procedure TForm1.TrayIcon1Click(Sender: TObject);
begin
  Visible := not Visible;
end;

end.

相关阅读 >>

比cmd更强大的命令行wmic

Delphi 如何从文本内容中删除指定行

Delphi 的 webservice 的 cookie 操作

Delphi 实现关闭指定进程,自身防杀

Delphi 时间到就触发事件

Delphi 10.4.1 edgebrowser 模拟操作网页方法

Delphi禁止webbrowser弹出窗口或者脚本错误

Delphi版内存共享

Delphi压缩库 zlibex 介绍

Delphi android使用idhttp.get抓取https(ssl)文件

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



打赏

取消

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

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

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

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

评论

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