开发者

How do I leverage a control from a C++/CLI project for use in my WPF application?

I have found an example of a control written in C++/CLI that grabs and displays a webcam feed using DirectShow. I'd like to take this example and utilize it from my WPF application. I've tried (and butchered) several different approaches, including taking the Webcam class and creating a HwndHost from my WPF application to load the Webcam control into. I've hit dead ends with all of these things开发者_StackOverflow社区 but my understanding of what I'm attempting to achieve isn't enough to form a specific enough question.

So, I'm looking for some guidance on the overall approach I should be taking to achieve this. What do I need to do to expose the C++ webcam component to be consumable by my WPF application? And then what approach should I take to consume that C++ component - Wrapper? PInvoke? Something else?


If you want a Webcam in WPF you can try my WPF MediaKit. It has a VideoCaptureElement you can use and you will not have any airspace issues.

If you want to use your webcam class and use .NET, I would first try getting it to work in a Winforms control. When you have that working, try the WindowsFormsHost control. It will be much easier for you to use vs the raw HwndHost.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜