libuiohook
libuiohook copied to clipboard
Qt integrate with libuiohook
Hi, we tray integrate libuiohook with Qt app and when we run app and close is we have error: get_keyboard_layout_file [455]: RegOpenKeyEx failed to open key: "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0"! 21:07:19: The program has unexpectedly finished. 21:07:19: The process was ended forcefully.
Can you tell me what is problem. We test on win 10 and win 7 not different. I use: demo_hook_async.c
Thanks!
Are you building the 1.1 branch? This should be fixed there, but I haven't thoroughly tested.
Yes i use 1.1 branch. When i add integrate with QT i find one more small bug in code and fix to in Win and Osx platform (X11 not test). You can fast tray test add this make file in you QT and run it with you libuiohook in win. add you libary in folder name "third_party"
INCLUDEPATH += third_party/libuiohook/include
third_party/libuiohook/src
SOURCES += third_party/libuiohook/src/logger.c
win32: SOURCES += third_party/libuiohook/src/windows/input_helper.c
third_party/libuiohook/src/windows/input_hook.c
third_party/libuiohook/src/windows/post_event.c
third_party/libuiohook/src/windows/system_properties.c
macx: SOURCES += third_party/libuiohook/src/darwin/input_helper.c
third_party/libuiohook/src/darwin/input_hook.c
third_party/libuiohook/src/darwin/post_event.c
third_party/libuiohook/src/darwin/system_properties.c
unix:!macx: SOURCES += third_party/libuiohook/src/x11/input_helper.c
third_party/libuiohook/src/x11/input_hook.c
third_party/libuiohook/src/x11/post_event.c
third_party/libuiohook/src/x11/system_properties.
macx: HEADERS +=
third_party/libuiohook/src/darwin/input_helper.h
third_party/libuiohook/include/uiohook.h
unix:!macx: HEADERS +=
third_party/libuiohook/src/x11/input_helper.h
win32: HEADERS +=
third_party/libuiohook/src/windows/input_helper.h
and we change this for make:
OSX work:
int *hook_thread_status = malloc(sizeof(int));
to
int hook_thread_status = (int) malloc(sizeof(int));
Win: DWORD *hook_thread_status = malloc(sizeof(DWORD)); to DWORD hook_thread_status = (DWORD) malloc(sizeof(DWORD));
int* and DWORD*
Last error i can figure how fix: get_keyboard_layout_file [455]: RegOpenKeyEx failed to open key: "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\0"!
This maybe fixed in 1.2, I made some adjustments to the code in question.
@mile1000 Not sure how much it will help you, but I use this library in a Qt app I work on.
I'm still improving the implementation, but it works:https://github.com/thebigG/Tasker/tree/main/Tasker/Engine/Hooks/XHook