WMP Native Exception

B

Brian

Hi all,

This is a follow up from my previous problem: when trying to use Windows
Media Player (via CFCOM) in a thread, I get a native exception
(ExceptionCode 0000005). This is done on simply instantiating WMP. This
only happens if I try this in a worker thread, if I do it within the main
thread all is well.

So, I'm suspecting the control is doing something it isn't allowed in a
thread (such as write to the main GUI). Does anyone have recommendations on
how I might get around this?

Thanks,
Brian
 
A

Alex Feinman [MVP]

In order to use interfaces across a thread boundary they need to be
marshalled (typically via a stream)
Is this the case with your application? Do you use interfaces created in a
different thread? If so, you need to do something about it - potential
solutions include using Control.Invoke or MessageWindow and SendMessage to
switch contexts.
If CFCOM gives you access to the interface pointers and QueryInterface, you
can use CoMarshalInterThreadInterfaceInStream and
CoGetInterfaceAndReleaseStream to do your own interface marshalling.

Another possibility - something you point out yourself, is that the control
attempts GUI operations on a worker thread. To address this you will *have*
to use Control.invoke or SendMessage and restrict all control operations to
the GUI thread
 
B

Brian

Hi Alex--

Thanks very much for the help. I'm not using interfaces in my project, but
I'm going to play around with some of the ideas below and see if I have any
success...

Thank you!
Brian
 

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

Top