1.键盘钩子处理程序 HookProc
2.键盘钩子安装程序 InstallHook
3.键盘钩子卸载程序 UnInstallHook
4.键盘钩子dll的加载,安装与释放
生成标准windows dll提供给其它工程用于键盘钩子安装与释放
声明:
#ifdef KEYBOARDHOOK_EXPORTS#define KEYBOARDHOOK_API __declspec(dllexport)#else#define KEYBOARDHOOK_API __declspec(dllimport)#endifHHOOK _hook;//用于保存安装与卸载Hook用的句柄HINSTANCE _hinst;//Hook实例的句柄LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);//Hook处理KEYBOARDHOOK_API bool InstallHook(void);//安装HookKEYBOARDHOOK_API bool UnInstallHook(void);//卸载Hook
实现:
#include "stdafx.h"#include "KeyboardHook.h"//处理键盘消
如果觉得《C++编写Windows全局键盘钩子记录键盘输入》对你有帮助,请点赞、收藏,并留下你的观点哦!