microsoft / Windows.UI.Composition-Win32-Samples

Windows.UI.Composition Win32 Samples
MIT License
459 stars 186 forks source link

Cursor capture behavior changed in Windows 11 #87

Open artths opened 3 years ago

artths commented 3 years ago

What were the changes to cursor capture in Windows 11? I need to take a capture and show the image on the same computer. I used to hide the system cursor with ShowSystemCursor(FALSE), but the cursor was still captured and shown in the final image. Now on Windows 11 (22000.100), if I hide the cursor, it is also not captured, if I don’t hide it, I see 2 cursors.

robmikh commented 3 years ago

Do you mean ShowCursor? If so, I'm unable to reproduce this. Although, I'm trying this on a slightly newer version, so it's possible a regression was fixed that has yet to go out.

artths commented 3 years ago

No, I mean private ShowSystemCursor() from user32.dll to hide system cursor completely. Or public MagShowSystemCursor does the same thing. If I use ShowCursor() I still see 2 cursors at the time.

robmikh commented 3 years ago

Hmmm, I switched my test app to use MagShowSystemCursor and still can't reproduce it. I'll see if I can get on the version of Windows you're using to see if this really was fixed in a newer version.

artths commented 3 years ago

Have you called the MagInitialize() prior to calling MagShowSystemCursor? Otherwise it won't work. I just tried build 22000.120 and still don't see the cursor in the captured image if the system cursor is completely hidden. I used your ScreenCaptureforHWND project, just added MagInitialize() and MagShowSystemCursor(FALSE). Maybe the reason is in Windows SDK version? I'm using 10.0.19041.0

robmikh commented 3 years ago

Yes, MagShowSystemCursor is working correctly. The SDK will not impact this kind of behavior, it doesn't contain implementations, just interfaces and metadata.

artths commented 3 years ago

22000.132 still has this issue. I'll wait for you to confirm that this has been fixed in newer releases. Thank you!