钩子学习:一个键盘线程钩子的实现
2007-07-25 23:06
375 查看
表述能力不行,先把代码放上来,有时间在详细说明:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Imports System.Runtime.InteropServices
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
Public Class MyHookClass MyHook
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'Hook键盘
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private Const WH_KEYBOARD As Integer = 2
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'Hook返回值
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private hHook As Integer = 0
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'定义引用变量防止CallbackOnCollectedDelegate错误的产生
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private HookProc As CallBack
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'回调函数
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Delegate Function CallBack()Function CallBack(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Public Event KeyDown As System.Windows.Forms.KeyEventHandler
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Public Event KeyUp As System.Windows.Forms.KeyEventHandler
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'获取线程ID的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function GetCurrentThreadId()Function GetCurrentThreadId() As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'设置Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function SetWindowsHookEx()Function SetWindowsHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer, ByVal HookProc As CallBack, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal hInstance As IntPtr, ByVal wParam As Integer) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理下一Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function CallNextHookEx()Function CallNextHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer, ByVal nCode As Integer, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'移除Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function UnhookWindowsHookEx()Function UnhookWindowsHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer) As Boolean
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'安装Hook,类型键盘线程钩子,失败返回0,成功返回钩子句柄
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Function SetHook()Function SetHook() As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
HookProc = New CallBack(AddressOf KeyBoardProc)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hHook = SetWindowsHookEx(WH_KEYBOARD, HookProc, IntPtr.Zero, GetCurrentThreadId)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return hHook
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'钩子处理子程
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Private Function KeyBoardProc()Function KeyBoardProc( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal nCode As Integer, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal wParam As IntPtr, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If nCode = 0 <
a8c4
span style="color:#0000ff;">Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If lParam.ToInt32 > 0 Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理键盘KeyDown事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RaiseEvent KeyDown(Me, New Windows.Forms.KeyEventArgs(CType(wParam, Windows.Forms.Keys)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If lParam.ToInt32 < 0 Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理键盘KeyUp事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RaiseEvent KeyUp(Me, New Windows.Forms.KeyEventArgs(CType(wParam, Windows.Forms.Keys)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return CallNextHookEx(hHook, nCode, wParam, lParam)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'移除Hook,成功返回True,失败返回False
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Function UnHook()Function UnHook() As Boolean
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return UnhookWindowsHookEx(hHook)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
End Class
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Imports System.Runtime.InteropServices
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
Public Class MyHookClass MyHook
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'Hook键盘
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private Const WH_KEYBOARD As Integer = 2
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'Hook返回值
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private hHook As Integer = 0
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'定义引用变量防止CallbackOnCollectedDelegate错误的产生
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Private HookProc As CallBack
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'回调函数
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Delegate Function CallBack()Function CallBack(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Public Event KeyDown As System.Windows.Forms.KeyEventHandler
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Public Event KeyUp As System.Windows.Forms.KeyEventHandler
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'获取线程ID的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function GetCurrentThreadId()Function GetCurrentThreadId() As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'设置Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function SetWindowsHookEx()Function SetWindowsHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer, ByVal HookProc As CallBack, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal hInstance As IntPtr, ByVal wParam As Integer) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理下一Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function CallNextHookEx()Function CallNextHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer, ByVal nCode As Integer, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'移除Hook的API声明
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
<DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Overloads Shared Function UnhookWindowsHookEx()Function UnhookWindowsHookEx( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal idHook As Integer) As Boolean
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'安装Hook,类型键盘线程钩子,失败返回0,成功返回钩子句柄
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Function SetHook()Function SetHook() As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
HookProc = New CallBack(AddressOf KeyBoardProc)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hHook = SetWindowsHookEx(WH_KEYBOARD, HookProc, IntPtr.Zero, GetCurrentThreadId)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return hHook
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'钩子处理子程
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Private Function KeyBoardProc()Function KeyBoardProc( _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal nCode As Integer, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal wParam As IntPtr, _
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ByVal lParam As IntPtr) As Integer
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If nCode = 0 <
a8c4
span style="color:#0000ff;">Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If lParam.ToInt32 > 0 Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理键盘KeyDown事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RaiseEvent KeyDown(Me, New Windows.Forms.KeyEventArgs(CType(wParam, Windows.Forms.Keys)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
If lParam.ToInt32 < 0 Then
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'处理键盘KeyUp事件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RaiseEvent KeyUp(Me, New Windows.Forms.KeyEventArgs(CType(wParam, Windows.Forms.Keys)))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
End If
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return CallNextHookEx(hHook, nCode, wParam, lParam)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
'移除Hook,成功返回True,失败返回False
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
Public Function UnHook()Function UnHook() As Boolean
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Return UnhookWindowsHookEx(hHook)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
End Function
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
End Class
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
相关文章推荐
- .NET 实现线程键盘鼠标钩子和全局鼠标键盘钩子
- 线程内键盘钩子实现Winforn快捷键(组合键)
- 每天学习一算法系列(31)(实现一个队列,队列的应用场景为:一个生产者线程将int 类型的数入列,一个消费者线程将int 类型的数出列)
- 编写一个多线程函数实现对数组排序,要求: 1.至少用两个线程 2.数组的元素值可以事先定义好,或者可以从键盘输入(增加一个线程)。 3.用一个线程对数组排序,用另一个线程输出排序结果。 4.保证先排好序,再输出。
- .NET 实现线程键盘鼠标钩子和全局鼠标键盘钩子
- Ant学习---第三节:使用Ant实现一个最小的项目编译
- singleton pattern的一个模板实现, 适用于单线程
- Js屏蔽按住键盘一直输入的问题,实现按住也只能输入一个字符
- 学习实践:使用模式,原则实现一个C++自动化测试程序
- Js屏蔽按住键盘不停输入内容的问题,实现按住也只能输入一个字符
- 实现一个线程的两种方法
- 前端攻城狮学习笔记一:实现一个遍历数组或对象里所有成员的迭代器
- 利用VB远线程注入技术实现键盘拦截的例子(无DLL)
- 学习javascript的闭包特性用C#来实现一个简单的例子
- 前端攻城狮学习笔记二:实现一个叫Man的类,包含attr, words, say三个方法。
- 一个无聊男人的疯狂《数据结构与算法分析-C++描述》学习笔记 用C++/lua/python/bash的四重实现(1) f(x) = 2f(x-1) + x^2
- 实现一个线程安全的内存池(使用线程私有数据机制TSD来实现)
- 【从0到1学习Java线程池】一个Java线程池的简单实现
- 《Orange's 一个操作系统的实现》学习笔记--特权级代码段之间的转移(四)
- Kotlin学习记录(三)—— 子线程获取数据,实现简单ListView