如何使程序最小化后在屏幕右下角显示小图标?

wsshun 2000-04-03 01:45:00
...全文
203 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
eaglet 2000-04-03
  • 打赏
  • 举报
回复
uses ....,ShellApi ;
type
TMainForm = class(TForm)
....
public
ShellNotify(mode : BYTE);
procedure OnNotifyIcon(var message: TMessage); message NOTIFYEVENT;
procedure OnSysCommand(var message: TMessage); message WM_SYSCOMMAND;
end ;

procedure TMainForm.ShellNotify(mode : BYTE);
//小图标处理函数
//mode 为0 加入小图标,为其它值删除小图标
var
notifyIcon : TNotifyIconData;
begin
notifyIcon.cbSize := sizeof(notifyIcon);
notifyIcon.Wnd := MainForm.Handle;
notifyIcon.uID := 100;
notifyIcon.uCallbackMessage := NOTIFYEVENT;//按下小图标触发的事件号
notifyIcon.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
notifyIcon.hIcon := MainForm.Icon.Handle; //图标句柄
notifyIcon.szTip := 'title';

if Mode = 0 then
Shell_NotifyIcon(NIM_ADD,@notifyIcon)
else
Shell_NotifyIcon(NIM_DELETE,@notifyIcon);
end;

procedure TMainForm.OnNotifyIcon(var message: TMessage);
//小图标事件处理函数
begin

end ;

procedure TMainForm.OnSysCommand(var message: TMessage);
//最小化时隐藏主窗体
begin
Inherited;
if message.wParam = SC_MINIMIZE then
MainForm.Visible := False;

end;

csdn2000 2000-04-03
  • 打赏
  • 举报
回复
http://www.csdn.net/Delphi/index.htm下有你所需要的。

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧