无法弄清楚如何使用 ffi 在 Dart 中使用 SetWindowsHookEx
Can't figure out how to use SetWindowsHookEx within Dart using ffi
我想使用 SetWindowsHookEx 在用户每次按键时调用一个函数
最接近我想要做的事情是键盘记录器
我一直从这些项目中得到启发GiacomoLaw/Keylogger and timsneath/win32/blob/master/example/tetris
我对 winapi 或 c++ 几乎没有经验,我正在学习 dart
对不起,我的代码很乱,重要的填充物是main.dart
、lib/native_functions/SetWindowsHookEx.dart
、lib/native_functions/GetModuleHandle.dart
、lib/native_functions/CallNextHookEx.dart
这是zip file
我刚刚添加了这个
hhook = SetWindowsHookEx(WH_KEYBOARD_LL, lpfn, hmod, 0);
// more code above ^
// i added this
final MSG msg = MSG.allocate();
while (GetMessage(msg.addressOf, 0, 0, 0) != 0) {
TranslateMessage(msg.addressOf);
DispatchMessage(msg.addressOf);
}
不要忘记为 GetMessage
、TranslateMessage
、DispatchMessage
编写绑定
我想使用 SetWindowsHookEx 在用户每次按键时调用一个函数
最接近我想要做的事情是键盘记录器
我一直从这些项目中得到启发GiacomoLaw/Keylogger and timsneath/win32/blob/master/example/tetris
我对 winapi 或 c++ 几乎没有经验,我正在学习 dart
对不起,我的代码很乱,重要的填充物是main.dart
、lib/native_functions/SetWindowsHookEx.dart
、lib/native_functions/GetModuleHandle.dart
、lib/native_functions/CallNextHookEx.dart
这是zip file
我刚刚添加了这个
hhook = SetWindowsHookEx(WH_KEYBOARD_LL, lpfn, hmod, 0);
// more code above ^
// i added this
final MSG msg = MSG.allocate();
while (GetMessage(msg.addressOf, 0, 0, 0) != 0) {
TranslateMessage(msg.addressOf);
DispatchMessage(msg.addressOf);
}
不要忘记为 GetMessage
、TranslateMessage
、DispatchMessage