You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to capture the mouse cursor using Windows native functions. I'm expecting that if successful, SetCapture will hide the mouse cursor, until I call ReleaseCapture
'A handle to the window in the current thread that is to capture the mouse.'
I'm seeing that on Windows, flutter opens 2 HWND (a main window, and a child window (the flutter view)). I've tried calling SetCapture for both and none of them work.
1st attempt was simply to get the hwnd using GetForegroundWindow and pass it to SetCapture - doesn't work. Here I did a bit of debugging and it seems that GetForegroundWindow returns the exact HWND value of the "flutter main window"
2nd attempt was to call SetCapture with the "flutter view" HWND. I have stored the HWND value from the PluginRegistrar using GetNativeWindow(), and later passed that to SetCapture() - doesn't work.
I'm sure I didn't make any errors in parsing / casting the hwnd to and from int64, or any other rookie mistake.
This discussion was converted from issue #773 on November 25, 2023 09:38.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to capture the mouse cursor using Windows native functions. I'm expecting that if successful, SetCapture will hide the mouse cursor, until I call ReleaseCapture
SetCapture requires a HWND param (https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setcapture)
'A handle to the window in the current thread that is to capture the mouse.'
I'm seeing that on Windows, flutter opens 2 HWND (a main window, and a child window (the flutter view)). I've tried calling SetCapture for both and none of them work.
1st attempt was simply to get the hwnd using GetForegroundWindow and pass it to SetCapture - doesn't work. Here I did a bit of debugging and it seems that GetForegroundWindow returns the exact HWND value of the "flutter main window"
2nd attempt was to call SetCapture with the "flutter view" HWND. I have stored the HWND value from the PluginRegistrar using GetNativeWindow(), and later passed that to SetCapture() - doesn't work.
I'm sure I didn't make any errors in parsing / casting the hwnd to and from int64, or any other rookie mistake.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions