简体   繁体   中英

C++ .exe in C# Application for live camera stream

I want to open a multiple C++ .exe application inside my C# WPF application GUI to show multiple live videostreams coming from multiple IP camera's.

I've tried looking into Interops but can't find an example that actually works for me.

My goal is to load the .exe into the C# WPF application GUI without window borders, close buttons, etc... and have it fixed in one place.

Technically, Windows GUI works fine across processes.

Change C++ app so it receives a command-line argument like ownerHwnd=0FE321 , and sets up new video window as a child of the window handle passes in that argument.

Change WPF app so it creates HwndHost One per camera is probably the simplest one. Or you can use single one per app, and position multiple video streams on that window. Pass HwndHost's window handle to the C++ app when starting streams. Write code to handle resize. Don't forget to listen for Exited event and react somehow.

The tricky part is IPC between these processes. You can't call functions, and there're also threading issues, like input focus (if your video renderer doesn't need user input, should be fine). One good IPC strategy for this case is sending/posting/responding to custom windows messages. Changing the C++ project into the DLL with a single exported function helps with that, but at the cost of stability.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM