如何给外部程序增加一个菜单Delphi源码.功能:增加的菜单能够有事件,如点击后能够知道是点的哪个菜单.这里有代码但没有事件产生:
AppendMenu(GetMenu(FindWindow(nil, 'MSN Messenger')),MF_STRING,3,'我的菜单');
这个菜单没有事件,如何再增加子菜单.
AppendMenu(GetMenu(FindWindow(nil, 'MSN Messenger')),MF_STRING,3,'我的菜单');
这个菜单没有事件,如何再增加子菜单.
解决方案 »
- 在Image1中画一个固定大小的矩形,矩形可随意拖动,矩形线条的粗细及颜色最好能由我自己来定义
- 二星, 对自己并不是一件好事....
- 我用FASTREPOT作的报表,为什么在别的打印机上无法打印?可以预览
- 关于数据采集器 casio dt900 串口通讯问题
- 自动关闭,報地址C000008不能寫
- 是一个老问题了,虽然很简单,但还是没有人会回答:)
- 关于Microsoft和Oracle对Delphi用ADO方式连接Oracle提供的两个驱动程序的问题。
- 如何使用assignfile?
- 怎样在DBGrid中重新执行我在Field中定义的OnGetText事件?
- 谁有madCodeHook.pas文件啊?急需!
- 能不能用query控件对ClientDataSet 中的数据进行查询......
- 如何动态创建数据集字段?
实际上用VC的做一个框架,代码就是这样子的(不用MFC)procedure WndProc(var MyMessage: TMessage); override;procedure TfMain.WndProc(var MyMessage: TMessage);
var
pt: TPoint;
begin
case MyMessage.Msg of
WM_CLOSE: //关闭事件
begin
application.Minimize;
end;
WM_CREATE:
begin
WM_TASKBARCREATED := RegisterWindowMessage('TaskbarCreated');
//创建托盘栏图标类
TrayIcon := TTrayIcon.Create(self);
TrayIcon.ActiveIcon.Handle := LoadIcon(HInstance, 'Tray0');
TrayIcon.DeActiveIcon.Handle := LoadIcon(HInstance, 'Tray1');
end;
WM_DESTROY: // 窗体销毁消息
begin
//释放托盘栏图标
TrayIcon.NotifyDelete(self.Handle);
//释放托盘栏图标类
TrayIcon.Free;
end;
WM_SYSCOMMAND:
case MyMessage.WParam of
SC_MINIMIZE: // 窗体最小化
application.Minimize
else
inherited;
end;
MYWM_NOTIFYICON:
case MyMessage.lParam of
WM_LBUTTONDBLCLK: //鼠标左键双击
begin
if self.Showing = true then
begin
application.Minimize;
self.Hide;
end
else
begin
self.Show;
application.Restore;
SetForegroundWindow(self.Handle);
end;
end;
WM_RBUTTONDOWN: //鼠标右键被按下
begin
GetCursorPos(pt);
SetForegroundWindow(self.Handle);
pmTrayIcon.Popup(pt.x,pt.y);
end
else
//调用父类的WndProc方法处理其它消息
inherited;
end;
else
if MyMessage.Msg = WM_TASKBARCREATED then //托盘栏防崩溃处理
begin
TrayIcon.NotifyDelete(self.Handle);
TrayIcon.NotifyAdd(self.Handle, self.Showing);
end
else
//调用父类的WndProc方法处理其它消息
inherited;
end;
end;