microsoft/Windows.UI.Composition-Win32-Samples

Cursor capture behavior changed in Windows 11

Opened this issue · 6 comments

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.

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.

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.

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.

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

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

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