在窗口最小化后有个图标在任务栏上。
在点击任务栏上的图标是怎样拦截点击事件。
请高手解答。
先谢谢了。
在点击任务栏上的图标是怎样拦截点击事件。
请高手解答。
先谢谢了。
解决方案 »
- Delphi中BDE连接Access问题!
- 请求高人 谁有delphi7类结构图和好的delphi参考手册。
- 关于日期函数!!!
- 如何控制treeview的行高
- 急找深圳 delphi 7 数据库开发高手.兼责做上几天10月21日前
- 哪位大哥知道哪有时钟控件下啊?
- activeform的小问题... 刚学习.. 请指教!!!
- 请问有没有函数可以播放指定时间的WAV文件? 比如我想从‘1分15秒’开始播放‘D.WAV’
- 关于F1book6打印预览的问题的讨论,pazee(耙子)请进,我们继续讨论。也欢迎对这个问题感兴趣的人。
- 各位老大,介绍两本delphi网络编程的一级棒的好书啊,我有急用
- Duplicate case label怎么办?
- 突然发现本人笨,简单的问题也只能求教
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus,ShellApi;const
MY_MESSAGE = WM_USER + 100;type
TfrmMain = class(TForm)
PopupMenu1: TPopupMenu;
mnuIcon: TMenuItem;
procedure mnuIconClick(Sender: TObject);
private
{ Private declarations }
procedure IconOnClick(var message:TMessage); message MY_MESSAGE;
public
{ Public declarations }
end;var
frmMain: TfrmMain;
NT:TNOTIFYICONDATA;implementation{$R *.dfm}procedure TfrmMain.IconOnClick( var message: Tmessage);
var
p : TPoint;
begin
if (message.lParam = WM_LBUTTONDOWN) then
;
if (message.lParam = WM_RBUTTONDOWN) then
begin
GetCursorPos(p);
self.PopupMenu1.Popup( p.x ,p.y );
end;
end;procedure TfrmMain.mnuIconClick(Sender: TObject);
begin
if Pos('缩为小图标',self.mnuIcon.Caption)>0 then
begin
with NT do begin
cbSize:=Sizeof(NT);
// nid变量的字节数
Wnd:=Handle;
// 主窗口句柄
UID:=0;
// 内部标识,可设为任意数
uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
uCallBackMessage:=MY_MESSAGE;
hIcon:=Icon.Handle;
// 要加入的图标句柄,可任意指定
szTip:='Delphi'#0;
// 提示字符串
hIcon := Application.Icon.Handle;
end;
Application.Minimize;
ShowWindow(Application.Handle,SW_HIDE);
Shell_NotifyIcon(NIM_ADD,@NT);
self.mnuIcon.Caption:='正常显示';
end
else
begin
Shell_NotifyIcon(NIM_DELETE,@NT);
ShowWindow(Application.Handle,SW_SHOW);
Application.Restore;
self.mnuIcon.Caption:='缩为小图标';
end;
end;end.