Can c++ operate on c# window handle?

  • Thread starter Thread starter violin wang
  • Start date Start date
V

violin wang

I use c# to build UI for my application and write a
unmanaged c++ dll which use DirectShow to play video.I
want the video image to display in a PictureBox on the
UI.Can I pass the handle of PictureBox to DirectShow as
video windows?If not, how can I reach my goal?

regards
violin
 
Hi,

If you do this, beware that invoking certain methods and properties will
actually cause the underlying window to be destroyed and recreated thus
rendering your previous handle invalid. To detect this situation, you can
handle the HandleCreated and HandleDestroyed events for the control.
Ideally, you should avoid adjusting properties that will result in the
window being recreated. The reason for this, is that some of the underlying
windows styles for instance can only be applied when the window is created,
so to hide this complexity the .NET framework just destroys and recreates a
new window with the required styles transferring all relevant properties etc
to the newly created window.

Hope this helps

Chris Taylor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top