INTERACT FORUM
Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: johnnynine on April 19, 2009, 04:35:55 pm
-
When I call ShowProgram(1) my application hangs. I'm wondering if this is a thread affinity issue. The ShowProgram() call is likely NOT being called on the same thread that the MCAutomationClass object is being created on.
When I call ShowProgram(1) immediately after getting a reference to the COM object, ShowProgram(1) works fine, but when I call it later (from another thread) it locks up.
I tried both of the following and they both result in the ShowProgram() method not returning, and the MC UI locks up (but it will continue to play music).
_mediaCenter.ShowProgram(1)
// Also tried:
Type t = _mediaCenter.GetType();
t.InvokeMember("ShowProgram", System.Reflection.BindingFlags.InvokeMethod, null, _mediaCenter, new object[1] { (int)1 });
I an not running this from a windows form, so I can not use Control.Invoke() to tun on the right thread.
Johnny
-
For things that use the user interface, you may not be able to cross thread boundaries.
It would be better for your thread to post a message back to the main thread that does the show.