Closed rjx-ray closed 10 months ago
Yea it should work. Can you share which build of Windows you're trying this on as well as the error code inside the hresult_error
object?
I'm running on Windows 11 Pro 22H2 SDK 10.0.19041.685
I'm having trouble getting the error code- this isn't working
CreateForWindow doesn't return, I just see
Its complicated by the fact that I'm running the capture in a DLL as the main project can't use WinRT. The call stack is
Usually this happens because the window you're trying to capture is deemed non-capturable by the shell. Is it always the same window? Does it work if you attempt to capture that window first?
Does this sample work for you for successive window captures?
So if I try and capture the second window first I get the exception straight away. I'll investigate the differences between the windows tomorrow.
What could make a window non-capturable?
The general rule of thumb is anything that shows up in the Alt+Tab view is considered capturable.
Thanks for your help. I can now do the successive captures. But its pretty slow, averaging ~10fps and I'm having to wait up to 100ms for the new frame. I guess that's to be expected. Is it possible to run multiple simultaneous capture instances?
I'm a little surprised you're seeing that kind of performance. What hardware are you running on?
Yes, you should be able to run more than one capture at once. There is a bug in Windows 10 when running multiple captures from the same GraphicsCaptureItem object though.
Just to say that our main app can now use WinRT and I don't need to run the capture in a DLL any more. All these issues have now gone away and I can do multiple simultaneous captures at full speed
I can successfully capture a window without problems. However I now need to capture 2 or more windows. I am trying to do this by stopping the current capture with this code
if (m_capture) { m_capture->Close(); m_capture = nullptr; m_itemClosedRevoker.revoke(); }
And then restarting with the new HWND However on restart I get a winrt:hresult_error exception in interop_factory->CreateForWindowCan this be made to work?