这个要先取得每个菜单项的句柄,再在Hook中判断才行.
解决方案 »
- activex exe 如何高效从主程序中获取msf表格中大量数据的好办法?
- 当我一运行就出现"用户定义类型未定义"的错误提示.我用的是vb6.0,我在在工程中也引用 Microsoft
- 关于引用变量储存字符串的问题
- 创建了个群,欢迎开发高手和专家加入,不限技术,欢迎各路高手加入
- 怎么检索是否包含关键字
- SHELL打开文件的问题
- 为何生成可执行文件后 CreateWindowEx 返回值就变成了 0?
- 如何在事件中自动选择treeview中的一项?
- 我想买个17寸纯平显示器,请大家给点意见吧!
- 大家好,认识一下希望大家以后多多关照!!!
- 请问hikylin()大哥:
- 如何禁止窗体resize()?谢谢
我有个更好的:在frmMain中添加一个Command1:Option Explicit
DefLng A-Z
Private Sub Command1_Click()Dim lprc As RECT'// Show the system menu below this command button
Call GetWindowRect(Command1.hWnd, lprc)
Call SendMessage(Me.hWnd, WM_GETSYSMENU, 0, ByVal MAKELONG(lprc.Left, lprc.Bottom + 2))
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)Dim lppt As POINTAPI'// Show the system menu at the cursor position
'// Note that the coordinates the message accepts are relative to the screen
If Button = vbRightButton Then
Call GetCursorPos(lppt)
Call SendMessage(Me.hWnd, WM_GETSYSMENU, 0, ByVal MAKELONG(lppt.X, lppt.Y))
End IfEnd Sub以下在模块中:Option Explicit
DefLng A-ZType RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End TypeType POINTAPI
X As Long
Y As Long
End TypeDeclare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal nCount As Long)
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long'// Undocumented window message.
Public Const WM_GETSYSMENU = &H313Public Function LOWORD(dwValue As Long) As Long
CopyMemory LOWORD, dwValue, 2
End FunctionPublic Function MAKELONG(wLow As Long, wHigh As Long) As Long
MAKELONG = LOWORD(wLow) Or (&H10000 * LOWORD(wHigh))
End Function