| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 569 人关注过本帖
标题:全局钩子安装成功可是回调函数没成效哪位大哥能帮我看下
只看楼主 加入收藏
li86791177
Rank: 2
等 级:论坛游民
帖 子:33
专家分:22
注 册:2012-12-29
结帖率:100%
收藏
 问题点数:0 回复次数:1 
全局钩子安装成功可是回调函数没成效哪位大哥能帮我看下
钩子安装成功 可是检测不出 键盘码9 是什么原因
工程源码
Private Sub Form_Load()
hhook = SetWindowsHookEx(WH_KEYBOWN_LL, AddressOf myhook, App.hInstance, 0)
If hhook = 0 Then
End
Else
Print hhook
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnhookWindowsHookEx hhook
End Sub
模块源码
Public Declare Function CallNextHookEx Lib "user32" (ByVal hhook As Long, ByVal ncode As Long, ByVal wparam As Long, lparam As Any) As Long

Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hhook As Long) As Long
Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
'定义常量
Public Const WH_KEYBOARD_LL = 13
Public Const HC_ACTION = 0


Public hhook As Long


Public Function myhook(ByVal ncode As Long, ByVal wparam As Long, ByVal lparam As Long) As Long
If ncode = 0 Then
If wparam = WM_KEYDOWN Then
wparam = 9
MsgBox "22"

End If
End If

myhook = CallNextHookEx(hhook, ncode, wparam, lparam)
End Function
搜索更多相关主题的帖子: 安装 成功 
2013-05-08 19:36
li86791177
Rank: 2
等 级:论坛游民
帖 子:33
专家分:22
注 册:2012-12-29
收藏
得分:0 
看到的大哥研究过懂得大哥回复下  就是在钩子检测键盘的一个按键检测不出来 放心不是搞马 是热键暂停程序
2013-05-08 20:43
快速回复:全局钩子安装成功可是回调函数没成效哪位大哥能帮我看下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025451 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved