So, #windows11. It's been out for a while, and I thought it would be safe to upgrade?
Except that the #update broke a most unexpected part of my side project: the Win32 #BitBlt API (and friends).
If you want to capture the pixels in another window, you have been able to use BitBlt since... forever. And this worked fine on Windows 10. But, now it doesn't.
To be more precise, you seem to be able to do it _once_ -- and you'll capture some good looking pixels. But subsequent calls don't seem to work.
I suspect Microsoft have been trying to deprecate it for a while, because windows aren't bitmaps anymore, they're DirectX buffers. There must have been some compat layer that made BitBlt work until now.
So, what to do? Well, to the best that I can tell, that's what the new #ScreenCapture API is for: https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/screen-capture
A couple of things that I'm chewing on:
- The app I'm building is traditional .NET WinForms because... well, it works. But the APIs aren't supported there.
- They _are_ supported in UWP -- but making a UWP app forces the use of the window picker, which will create some inefficiencies in my workflow.
- Also: UWP is deprecated, and it's not clear what the new hotness is.
I think OBS uses these APIs, so there must be another way to make it work. I'm still scratching my head over it.