VB如何调用 系统的菜单(关闭的菜单)
展开全部
用API,GetSystemMenu取得系统菜单句柄,然后用TrackPopupMenu弹出
这里有个例子是修改系统菜单条目的,可以参考
http冒号//www.tesoftware.net/code/form/200.htm
这里有个例子是修改系统菜单条目的,可以参考
http冒号//www.tesoftware.net/code/form/200.htm
追问
你是网上Copy的吧,网上也有这个方法,虽然有菜单了,但是菜单里面的菜单项不能用啊。。
追答
嗯,百度一下全都有了,自己摸索的,记忆牢靠。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
是 点击开始后弹出的菜单吗
追问
= =、我问题写得很清楚,就是任务栏上面 右击一个任务,出来的菜单, 开始里边的是 关机。。不是关闭
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Any) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim p As POINTAPI, sm&
If Button = 2 Then
GetCursorPos p
sm = TrackPopupMenu(GetSystemMenu(Me.hwnd, 0), &H0& Or &H100&, p.x, p.y, 0, Me.hwnd, ByVal 0&)
End If
If sm <> 0 Then
SendMessage Me.hwnd, &H112, sm, 0&
End If
End Sub
x As Long
y As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Any) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim p As POINTAPI, sm&
If Button = 2 Then
GetCursorPos p
sm = TrackPopupMenu(GetSystemMenu(Me.hwnd, 0), &H0& Or &H100&, p.x, p.y, 0, Me.hwnd, ByVal 0&)
End If
If sm <> 0 Then
SendMessage Me.hwnd, &H112, sm, 0&
End If
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询