INTERACT FORUM

Windows => Plug-in Development => Topic started by: dean70 on November 26, 2015, 04:55:01 pm

Title: Issue with COM Interface from C++
Post by: dean70 on November 26, 2015, 04:55:01 pm
I have found an issue with the COM Interface when connecting to JRiver from an Out of Process exe. The following code will fail with an 'Invalid Class String' HRESULT on both calls:

HRESULT hr = pMJ.GetActiveObject(L"MediaJukebox Application");
    if (hr != S_OK)
        hr = pMJ.CreateInstance(L"MediaJukebox Application");
    if (hr != S_OK)
   return false;

If I replace the L"MediaJukebox Application" with the corresponding GUID L"{572802d5-fbf6-4c30-89ca-bdf2ce4aec2b}", the call will work correctly. I found the GUID from the .tlh file auto-generated by Visual C++ 2010 during compile.

Any ideas why the Automation object cannot be instantiated by its name?

Title: Re: Issue with COM Interface from C++
Post by: Matt on November 26, 2015, 06:11:58 pm
This is the code:
https://wiki.jriver.com/index.php/Media_Center_Automation

I'm not sure what's going wrong.
Title: Re: Issue with COM Interface from C++
Post by: dean70 on November 26, 2015, 07:28:38 pm
Thanks, I used this page as a template for the code.

I am using this to load the tlb:
#import "C:\Program Files (x86)\J River\Media Center 20\Media Center 20.tlb" no_namespace, named_guids \
   rename("DeleteFile","MCDeleteFile") \
   rename("MoveFile","MCMoveFile") \
   rename("ReportEvent","MCReportEvent")


...anyway it is working now using the GUID above. I can now have an OSD volume control similar to Theatre View for the NetFlix app, which is routing audio through the WDM Driver.  ;D