Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt integrate with libuiohook #65

Open
mile1000 opened this issue Jan 13, 2020 · 4 comments
Open

Qt integrate with libuiohook #65

mile1000 opened this issue Jan 13, 2020 · 4 comments

Comments

@mile1000
Copy link

mile1000 commented Jan 13, 2020

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!

@kwhat
Copy link
Owner

kwhat commented Jan 15, 2020

Are you building the 1.1 branch? This should be fixed there, but I haven't thoroughly tested.

@mile1000
Copy link
Author

mile1000 commented Jan 16, 2020

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"!

@kwhat
Copy link
Owner

kwhat commented Sep 28, 2021

This maybe fixed in 1.2, I made some adjustments to the code in question.

@thebigG
Copy link

thebigG commented Jun 4, 2022

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants