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

Mouse interaction #30

Closed
rocksdanister opened this issue Mar 22, 2020 · 2 comments
Closed

Mouse interaction #30

rocksdanister opened this issue Mar 22, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@rocksdanister
Copy link
Owner

rocksdanister commented Mar 22, 2020

Basically using hooks to capture mouse data & forwarding using PostMessage to the wallpaper HWND.
Clicks will be disabled when not on desktop, movement will still be forwarded.

Once its ready you can just use usual functions in Javascript(for webpage) or your code of choice to retrieve mouse location & clicks.

Preview (web wallpapers): https://youtu.be/mhhmV-DSjGY

//Sample code
UInt32 lParam = Mouse.Y;
lParam <<= 16; 
lParam |= Mouse.X;
PostMessageW(HWND, WM_LBUTTONDOWN, (IntPtr)0x0001, (IntPtr)lParam);

Reference: https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-lbuttondown

@rocksdanister
Copy link
Owner Author

rocksdanister commented Mar 23, 2020

Directly using global mousehook is hanging the cursor when UI thread is occupied

Possible solutions:

  1. Multithread the hook library.
  2. Make it a separate program.
  3. Use alternatives: RawInput

Decided to use option 3, RawInput instead.

@rocksdanister
Copy link
Owner Author

rocksdanister commented Mar 26, 2020

Done v0.9.5

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

No branches or pull requests

1 participant