VB 如何取消PopupMenu的弹出菜单
我想实现当点击鼠标左键,取消PopupMenu的弹出菜单,在网上找到如下方法,但是当点击右键时会出现错误“找不到DLL入口点SetForegroundWindowinus...
我想实现当点击鼠标左键,取消PopupMenu的弹出菜单,在网上找到如下方法,但是当点击右键时会出现错误“找不到DLL入口点SetForegroundWindow in user32”。
模块中定义API
Public Declare Function SetForegroundWindow Lib "user32 " _
Alias "SetForegroundWindow " (ByVal hwnd As Long) As Long
Private Sub cSysTray1_MouseDown(Button As Integer, Id As Long)
If Button = 2 Then
SetForegroundWindow Me.hwnd
PopupMenu mnuFile
End If
End Sub 展开
模块中定义API
Public Declare Function SetForegroundWindow Lib "user32 " _
Alias "SetForegroundWindow " (ByVal hwnd As Long) As Long
Private Sub cSysTray1_MouseDown(Button As Integer, Id As Long)
If Button = 2 Then
SetForegroundWindow Me.hwnd
PopupMenu mnuFile
End If
End Sub 展开
3个回答
展开全部
请注意:第一行的 "user32 " 中“32”后面多了一个空格!!!
建议:在网上找到API声明后,先记住它的名称【如:SetForegroundWindow 】
再用Vb自带的API浏览器自己制作声明再添加到模块上,这样,万无一失!
建议:在网上找到API声明后,先记住它的名称【如:SetForegroundWindow 】
再用Vb自带的API浏览器自己制作声明再添加到模块上,这样,万无一失!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
去掉"user32 "和"SetForegroundWindow "中的空格。
Public Declare Function SetForegroundWindow Lib "user32" _
Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
Public Declare Function SetForegroundWindow Lib "user32" _
Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub cSysTray1_MouseDown(Button As Integer, Id As Long)
If Button = 2 Then
SetForegroundWindow Me.hwnd
PopupMenu mnuFile
End If
End Sub
Private Sub cSysTray1_MouseDown(Button As Integer, Id As Long)
If Button = 2 Then
SetForegroundWindow Me.hwnd
PopupMenu mnuFile
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询