IltmmSupportManager::UnlockSupport Example for C++

IltmmSupportManager* m_pSprtMngr; 

HRESULT CConvertDlg::DVDUnlockSupport()
{
   VARIANT_BOOL vb; 

   HRESULT hr = CoCreateInstance(CLSID_ltmmSupportManager, NULL, CLSCTX_INPROC_SERVER, IID_IltmmSupportManager, (void**)&m_pSprtMngr); 
   if (hr != S_OK) 
      return -1; 

   m_pSprtMngr->IsSupportLocked (L_SUPPORT_CONVERTFROMDVD, &vb); 
   if (vb == VARIANT_TRUE) 
   {
      static TCHAR L_KEY_CONVERTFROMDVD[] = "DVDKey";

      USES_CONVERSION; 
      hr = m_pSprtMngr->UnlockSupport (L_SUPPORT_CONVERTFROMDVD, T2OLE(L_KEY_CONVERTFROMDVD)); 
      if (hr != S_OK) 
      {
         m_pSprtMngr->Release();
         return hr; 
      }
      m_pSprtMngr->IsSupportLocked (L_SUPPORT_CONVERTFROMDVD, &vb); 
      if (vb != VARIANT_FALSE) 
         return E_FAIL; 

      return S_OK; 
   }

   return S_OK; 
}