procedure IconOnClick(var message:TMessage); message MI_ICONEVENT;过程声明出错?源程序如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi, ExtCtrls, ImgList, StdCtrls, Buttons, Menus;type
TForm1 = class(TForm)
ImageList1: TImageList;
BitBtn1: TBitBtn;
PopupMenu1: TPopupMenu;
PopupMenu2: TPopupMenu;
hfghfg1: TMenuItem;
hgfhfg1: TMenuItem;
hfghfgh1: TMenuItem;
hfghf1: TMenuItem;
hfgh1: TMenuItem;
hgf1: TMenuItem;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure IconOnClick(var message:TMessage); message MI_ICONEVENT;出错
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
{托盘图标常量}
Icon_ID=1; //图标标识
MI_ICONEVENT=WM_USER+$1000;
var
Form1: TForm1;
ycicon:TNotifyIconData;
noicon,yesicon:ticon;
Icon:HICON;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
noicon:=ticon.Create;
noicon:=Self.Icon;
yesicon:=ticon.Create;
yesicon:=Self.Icon;
ycicon.cbSize:=sizeof(TNotifyIconData);
ycicon.Wnd:=handle;
ycicon.uID:=Icon_ID;
ycicon.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
ycicon.uCallbackMessage:=MI_ICONEVENT;
ycicon.szTip:='汽车维修管理!';
ycicon.hIcon:=noicon.Handle;
shell_notifyicon(nim_add,@ycicon);
end;procedure TForm1.BitBtn1Click(Sender: TObject);
var ycicon:TNotifyIconData;
begin
ycicon.cbSize:=SizeOf(ycicon);
ycicon.Wnd:=Handle;
ycicon.uID:=Icon_ID;
Shell_NotifyIcon(NIM_DELETE,@ycicon);
end;procedure tform1.IconOnClick(var message:TMessage);// message MI_ICONEVENT;
var p:TPoint;
begin
if message.LParam=WM_LBUTTONDOWN then //单击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu2');
form1.PopupMenu2.popup(p.x,p.y);
end;
if message.LParam=WM_LBUTTONDBLCLK then //双击事件
form1.Show;
if message.LParam=WM_RBUTTONDOWN then //右击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu1');
//form1.PopupMenu1.popup(p.x,p.y);
showwindow(form1.Handle,sw_shownormal);
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
form1.Hide;
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
form1.PopupMenu2.popup(750,580);
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi, ExtCtrls, ImgList, StdCtrls, Buttons, Menus;type
TForm1 = class(TForm)
ImageList1: TImageList;
BitBtn1: TBitBtn;
PopupMenu1: TPopupMenu;
PopupMenu2: TPopupMenu;
hfghfg1: TMenuItem;
hgfhfg1: TMenuItem;
hfghfgh1: TMenuItem;
hfghf1: TMenuItem;
hfgh1: TMenuItem;
hgf1: TMenuItem;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure IconOnClick(var message:TMessage); message MI_ICONEVENT;出错
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
{托盘图标常量}
Icon_ID=1; //图标标识
MI_ICONEVENT=WM_USER+$1000;
var
Form1: TForm1;
ycicon:TNotifyIconData;
noicon,yesicon:ticon;
Icon:HICON;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
noicon:=ticon.Create;
noicon:=Self.Icon;
yesicon:=ticon.Create;
yesicon:=Self.Icon;
ycicon.cbSize:=sizeof(TNotifyIconData);
ycicon.Wnd:=handle;
ycicon.uID:=Icon_ID;
ycicon.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
ycicon.uCallbackMessage:=MI_ICONEVENT;
ycicon.szTip:='汽车维修管理!';
ycicon.hIcon:=noicon.Handle;
shell_notifyicon(nim_add,@ycicon);
end;procedure TForm1.BitBtn1Click(Sender: TObject);
var ycicon:TNotifyIconData;
begin
ycicon.cbSize:=SizeOf(ycicon);
ycicon.Wnd:=Handle;
ycicon.uID:=Icon_ID;
Shell_NotifyIcon(NIM_DELETE,@ycicon);
end;procedure tform1.IconOnClick(var message:TMessage);// message MI_ICONEVENT;
var p:TPoint;
begin
if message.LParam=WM_LBUTTONDOWN then //单击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu2');
form1.PopupMenu2.popup(p.x,p.y);
end;
if message.LParam=WM_LBUTTONDBLCLK then //双击事件
form1.Show;
if message.LParam=WM_RBUTTONDOWN then //右击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu1');
//form1.PopupMenu1.popup(p.x,p.y);
showwindow(form1.Handle,sw_shownormal);
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
form1.Hide;
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
form1.PopupMenu2.popup(750,580);
end;end.
解决方案 »
- 请问一下如何获取Canvas上的图像呢?
- delphi中有防SQL注入的吗?谁能告诉我啊
- DateTimePicker 的奇怪问题???
- 初学者请教高手。。。。。。。。。谢谢谢
- 我用WebBrowser编了一个浏览器,但如果点击的超链接是新窗口打开的(target="_blank"),出来的还是IE啊,怎么办?
- 在DELHPI6.0中如何编写农历程序
- 高手千万别错过,进来看一看,很怪的保存图像问题?来者给分。
- 面临就业的大四学生的几点迷惑----望各位过来人指点迷津
- 在DELPHI里面有没有读取时间的函数,其精确到毫秒的??急救。
- 问个非常简单但是我搞不明白的问题,在线等。
- 怎样设置wwBGrid页脚上的合计字段?
- 請問如何在存儲過程中創建和刪除一個臨時表?
interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi, ExtCtrls, ImgList, StdCtrls, Buttons, Menus;const
{托盘图标常量}
Icon_ID=1; //图标标识
MI_ICONEVENT=WM_USER+$1000;type
TForm1 = class(TForm)
ImageList1: TImageList;
BitBtn1: TBitBtn;
PopupMenu1: TPopupMenu;
PopupMenu2: TPopupMenu;
hfghfg1: TMenuItem;
hgfhfg1: TMenuItem;
hfghfgh1: TMenuItem;
hfghf1: TMenuItem;
hfgh1: TMenuItem;
hgf1: TMenuItem;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure IconOnClick(var message:TMessage); message MI_ICONEVENT;出错
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ycicon:TNotifyIconData;
noicon,yesicon:ticon;
Icon:HICON;
implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
noicon:=ticon.Create;
noicon:=Self.Icon;
yesicon:=ticon.Create;
yesicon:=Self.Icon;
ycicon.cbSize:=sizeof(TNotifyIconData);
ycicon.Wnd:=handle;
ycicon.uID:=Icon_ID;
ycicon.uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
ycicon.uCallbackMessage:=MI_ICONEVENT;
ycicon.szTip:='汽车维修管理!';
ycicon.hIcon:=noicon.Handle;
shell_notifyicon(nim_add,@ycicon);
end;procedure TForm1.BitBtn1Click(Sender: TObject);
var ycicon:TNotifyIconData;
begin
ycicon.cbSize:=SizeOf(ycicon);
ycicon.Wnd:=Handle;
ycicon.uID:=Icon_ID;
Shell_NotifyIcon(NIM_DELETE,@ycicon);
end;procedure tform1.IconOnClick(var message:TMessage);// message MI_ICONEVENT;
var p:TPoint;
begin
if message.LParam=WM_LBUTTONDOWN then //单击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu2');
form1.PopupMenu2.popup(p.x,p.y);
end;
if message.LParam=WM_LBUTTONDBLCLK then //双击事件
form1.Show;
if message.LParam=WM_RBUTTONDOWN then //右击事件
begin
GetCursorPos(p);
//showmessage('PopupMenu1');
//form1.PopupMenu1.popup(p.x,p.y);
showwindow(form1.Handle,sw_shownormal);
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
form1.Hide;
end;procedure TForm1.BitBtn3Click(Sender: TObject);
begin
form1.PopupMenu2.popup(750,580);
end;end.