怎样获取右键的弹出菜单句柄(在同一窗体的不同地方弹出的菜单不同),并且不可见

liuyan4794 2003-08-11 02:31:20
怎样获取右键的弹出菜单句柄(在同一窗体的不同地方弹出的菜单不同),并且不可见,但可以向菜单的发送命令(如单击)
...全文
364 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuyan4794 2003-08-14
  • 打赏
  • 举报
回复
qhluo02(*QHcsnd02) ,窗体不是我创建的
zyl910(910:分儿,我又来了!) ,能否说的详细一点?
pigpag 2003-08-14
  • 打赏
  • 举报
回复
不管是谁创建的窗口都可以
zyl910 2003-08-14
  • 打赏
  • 举报
回复
WM_INITMENUPOPUP
The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.

WM_INITMENUPOPUP
hmenuPopup = (HMENU) wParam; // handle to submenu
uPos = (UINT) LOWORD(lParam); // submenu item position
fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag

Parameters
hmenuPopup
Value of wParam. Handle to the drop-down menu or submenu.
uPos
Value of the low-order word of lParam. Specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu.
fSystemMenu
Value of the high-order word of lParam. Specifies whether the drop-down menu is the window menu (also known as the System menu or the Control menu). If the menu is the window menu, this parameter is TRUE; otherwise, it is FALSE.
Return Values
If an application processes this message, it should return zero.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.

zyl910 2003-08-11
  • 打赏
  • 举报
回复
用SetWindowsHookEx挂上WH_CALLWNDPROC钩子
接收到WM_INITMENUPOPUP的时候判断hWnd是否是该窗口
qhluo02 2003-08-11
  • 打赏
  • 举报
回复
先建立一个菜单,再从MouseDown方法的中实现,右键的Button值是2

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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