Does anybody have any simple examples on how to provide C++ code a window that can be used for DirectShow rendering from a C# UserControl?
I am currently able to create a separate and render to a window via a WS_POPUP window and match its size/position to the existing control window I have reserved for the video pane on the WPF control.
As soon as I try to make the window a child of the WPF control or set WS_CHILD on a new or existing window everything stops rendering and I receive no error explaining what is going on.
Ideally I would be able to pass existing HWND from C# through to the C++/DirectShow class and use it there as-is.
PS
Before you ask "Why don't you just... do something different", I need to control DirectShow from C++ and have to display the results via a C# (WPF) control. I have no control over these conditions.
C#/WPF (control reserved) <---> C++/CLI <---> C++/HWND/DirectShow
The best way of achieving this would be to use VMR in the windowless mode. The following snippet of code illustrates this(This is for working code. I have removed error checks etc but should give you an idea):
pVMRConfig->SetRenderingMode(VMRMode_Windowless);
m_VMR->QueryInterface(IID_IVMRWindowlessControl9, (void**)&pVMRWindowlessControl);
//displayWnd is what you pass in from your C# app
pVMRWindowlessControl->SetVideoClippingWindow(displayWnd);
RECT rcDest;
GetClientRect(displayWnd, &rcDest);
hr = pVMRWindowlessControl->SetVideoPosition(NULL, &rcDest);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.