Writing Windows Media Files for C++

The following code example illustrates the basic steps in this process:

// include the LEAD Multimedia TOOLKIT header
#include "ltmm.h" 
// include the Windows Media SDK header
#include "wmsdkidl.h" 
// EnableWindowsMedia
// enables the convert object to write Windows Media file formats
// pConvert – IltmmConvert interface pointer
HRESULT EnableWindowsMedia(IltmmConvert* pConvert) 
{   
   HRESULT hr;
   IUnknown* punkCert;
   // create Windows Media Certificate
   hr = WMCreateCertificate(&punkCert);
   if(SUCCEEDED(hr))
   {      // assign the certificate to the convert object
      hr = pConvert->put_WMCertificate (punkCert);
      punkCert->Release();
   }
   return hr;
}