[wdmaudiodev] Create an object of an APO in a win32 APP

  • From: Abhinav Singh <abhinav4ever@xxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Tue, 23 Dec 2014 02:53:50 +0530

I am using the code below to create an object of an APO from a  normal win32 
app. The intention is to check whether the APO is installed in the PC. However 
i get a Class Not Registered error every time i execute the below piece of 
code. 
HRESULT isExistAPO(CLSID CLSID_ClassID, IID IID_InterfaceID)    {               
  // CLSID_ClassID is the class GUID of the APO                
//IID_InterfaceID is the interface ID of the APO
                //CoInitialize(NULL);
                CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
                HRESULT hr = S_OK;
                IUnknown *pAPO = NULL;
                hr = CoCreateInstance(CLSID_ClassID,                    NULL,   
                CLSCTX_INPROC_SERVER,                   IID_InterfaceID,        
                (void**)&pAPO);         if (SUCCEEDED(hr))              {       
                //APO found                     pAPO->Release();                
}               else            {                       //Failed                
}               CoUninitialize();               return hr;      }               
                          

Other related posts: