So I'm now in the middle of trying to develop my second J River media center plugin type application.
I gave up on the first one after coming across this problem, and now that it's been about 6 months and I feel that I've more than scoured all the scattered bits and pieces of documentation that I could find, I figure I might as well ask for help as to how to actually use this library properly.
So my general purpose is to grab a handle to the COM library
Gather some currently playing song information
Release the COM handle
and go about my merry way
so I've been going about this like so
First I add the MediaCenter itl in the Media Center install director to my references
then
MediaCenter.MCAutomation mcAuto = new MCAutomation();
MediaCenter.IMJFileAutomation mcFileInfo = null;
//lots of null checks and stuff
if (mediaCenterAutomation.GetPlayback().State == MJPlaybackStates.PLAYSTATE_PLAYING)
{
if (mediaCenterAutomation.GetCurPlaylist() != null && mediaCenterAutomation.GetPlayback() != null)
{
mcFileInfo = mediaCenterAutomation.GetCurPlaylist().GetFile(mediaCenterAutomation.GetCurPlaylist().Position);
if (mcFileInfo != null)
{
String song = mcFileInfo.Name;
//got what I wanted
}
}
}
which all works out fine until I stop my application (usually for debugging purposes)
and then when I start the next application and go to do something I will get to here
MediaCenter.MCAutomation mcAuto = new MCAutomation();
and then I will get something like this
Retrieving the COM class factory for component with CLSID {572802D5-FBF6-4C30-89CA-BDF2CE4AEC2B} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
At first I assumed it was because I failed to release the COM handle but no matter how many attempts I make to close I still get the error
Googling has led me to believe it has something to me registering my plugin in the registry
I remember the wiki saying something about this
It must enter information in the registry to let Media Center know it exists. In C++, this can simply be a block of code added to the DllRegisterServer function. In VB, you will have to make a .reg file for the user to run on their machine. (see the included samples for examples of this)
But it doesn't give any details
there are no C# examples
not even a VB example
and I looked at the C++ Example but I don't understand what CLSID
is being used here
LPWSTR strID; StringFromCLSID(CLSID_SleepTimerCtrl, &strID);
I feel like I'm close but I can't figure it out... Can someone please help me out here?