SetCapture doesn't have any effect
alexvoina opened this issue · 0 comments
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?