首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

vb写老板键的时候提示:找不到DLL入口点 PeekMessageA in user32解决方法

2012-02-15 
vb写老板键的时候提示:找不到DLL入口点 PeekMessageA in user32我2行星号的位置Private Declare Function

vb写老板键的时候提示:找不到DLL入口点 PeekMessageA in user32
我2行星号的位置


Private Declare Function RegisterHotKey Lib "user32 " (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32 " (ByVal hWnd As Long, ByVal id As Long) As Long
Private Declare Function PeekMessage Lib "user32 " Alias "PeekMessageA " (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long

Private bCancel As Boolean
Private Const MOD_ALT = &H1
Private Const MOD_CONTROL = &H2
Private Const MOD_SHIFT = &H4
Private Const PM_REMOVE = &H1
Private Const WM_HOTKEY = &H312

Private Type Msg '定义Message类型
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
End Type

Private Sub proMsg() '声明进程
Dim Message As Msg
'循环直到bCancel为真
Do While Not bCancel
'检测到热键被按下则令窗体隐藏

***************************************************************************

If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then


******************************************************************************
Me.Visible = True
End If
DoEvents
Loop
End Sub

Private Sub Form_Load() '窗体加载时初始化程序
Dim ret As Long
bCancel = False
'定义热键为Ctrl F12
ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyF12)
Me.Visible = False窗体不可见
proMsg
End Sub

'退出时注销热键
Private Sub Form_Unload(Cancel As Integer)
bCancel = True
Call UnregisterHotKey(Me.hWnd, &HBFFF&)
End Sub


[解决办法]
"user32 "改为"user32"
[解决办法]
声明需要严格,最好用api阅览器复制。

VB code
Public Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long 

热点排行