当窗口最小化后,如何控制鼠标右键弹出来的菜单。 50 分。(0分)

  • 主题发起人 主题发起人 蛐蛐
  • 开始时间 开始时间

蛐蛐

Unregistered / Unconfirmed
GUEST, unregistred user!
如上。如最小化(alt + f4 ),关闭,恢复等 
 
这是我做的一个程序,但是最小化的时候是在显示一个图标在任务栏上。<br>只写出一部分,给你参考一下。<br>由于是在我自己的基础上改的,还没有运行,如果有错误就自己改一下<br>procedure TControlE.PopMenu(var PopMsg:TMessage);<br>var<br>&nbsp; PopUpMenu:TBcBarPopupMenu; &nbsp;//弹出菜单<br>&nbsp; SubItem:array[1..2] of TMenuItem; &nbsp;//菜单的子项<br>&nbsp; PosXY:TPoint; &nbsp;//弹出的位置<br>&nbsp; i:integer;<br>begin<br>&nbsp; &nbsp; &nbsp;if PopMsg.LParam=WM_RBUTTONDOWN &nbsp;//如果是右键<br>&nbsp; &nbsp; &nbsp;then begin<br>&nbsp; &nbsp; &nbsp; &nbsp;PopUpMenu:=TBcBarPopupMenu.Create(self);<br>&nbsp; &nbsp; &nbsp; &nbsp;PopUpmenu.Bar.BarBitmap.Bitmap.LoadFromFile(File_path+'/image/Coolmusicbar.bmp');<br>&nbsp; &nbsp; &nbsp; &nbsp;for i:=1 to 2 do<br>&nbsp; &nbsp; &nbsp; &nbsp;SubItem:=TMenuItem.Create(Self);<br>&nbsp; &nbsp; &nbsp; &nbsp;SubItem[1].Caption:='Show'; <br>&nbsp; &nbsp; &nbsp; &nbsp;PopUpMenu.Items.Add(SubItem[1]);<br>&nbsp; &nbsp; &nbsp; &nbsp;SubItem[2].Caption:='Close'; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp;PopUpMenu.Items.Add(SubItem[2]);<br>&nbsp; &nbsp; &nbsp; &nbsp;if GetCursorPos(PosXY) &nbsp;//获得窗口显示位置<br>&nbsp; &nbsp; &nbsp; &nbsp;then begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PopUpMenu.Popup(PosXY.x,PosXY.y); <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SubItem[1].OnClick:=PopupShow; <br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SubItem[2].OnClick:=PopupClose;<br>&nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp;end;<br>end;<br>procedure TControlE.PopupShow(Sender:TObject);<br>begin<br>&nbsp; ControlE.Visible:=True; <br>&nbsp; Shell_NotifyIcon(NIM_DELETE,pTaskBarIcon); &nbsp;<br>&nbsp; dispose(pTaskBarIcon); <br>end;<br>procedure TControlE.PopupClose(Sender:TObject);<br>begin<br>&nbsp; Shell_NotifyIcon(NIM_DELETE,pTaskBarIcon);<br>&nbsp; dispose(pTaskBarIcon);<br>&nbsp; Close; &nbsp;<br>end;<br><br>
 
接受答案了.
 
后退
顶部