IWMDRMContentAuthor::RemoveDRMProfile
![]() |
The RemoveDRMProfile method removes a DRM profile from the local computer.
Syntax
HRESULT RemoveDRMProfile(
BSTR bstrProfileID
);
Parameters
bstrProfileID
[in] BSTR specifying the ID of the DRM profile to remove.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
Example Code
// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include "C:\WMSDK\WMEncSDK9\include\wmdrmprf.h" // for DRM features
HRESULT hr;
IWMEncoder2* pEncoder;
IWMDRMContentAuthor* pDRM;
IWMDRMProfileCollection* pDRMProColl;
IWMDRMProfile* pDRMPro;
IWMDRMAttributes* pProAttr;
// Initialize the COM library and retrieve a pointer
// to an IWMEncoder interface.
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncoder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncoder2,
(void**) &pEncoder);
}
// Create an IWMDRMContentAuthor object.
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->get_EncoderDRMContentAuthor(&pDRM);
}
// Retrieve the collection of DRM profiles.
if ( SUCCEEDED( hr ) )
{
hr = pDRM->get_DRMProfileCollection(&pDRMProColl);
}
// Create an IWMDRMProfile object. Retrieve the first DRM profile.
CComVariant vIndex(0);
if ( SUCCEEDED( hr ) )
{
hr = pDRMProColl->Item(vIndex, &pDRMPro);
}
// Retrieve the ID of the current profile.
CComBSTR sProID;
if ( SUCCEEDED( hr ) )
{
hr = pDRMPro->get_ID(&sProID);
}
// Remove the profile.
if ( SUCCEEDED( hr ) )
{
hr = pDRM->RemoveDRMProfile(sProID);
}
// Release pointers.
if ( pDRM )
{
pDRM->Release();
pDRM = NULL;
}
if ( pDRMProColl )
{
pDRMProColl->Release();
pDRMProColl = NULL;
}
if ( pDRMPro )
{
pDRMPro->Release();
pDRMPro = NULL;
}
if ( pProAttr )
{
pProAttr->Release();
pProAttr = NULL;
}
if ( pEncoder )
{
pEncoder->Release();
pEncoder = NULL;
}
Requirements
Header: wmdrmprf.h
Library: wmenc.exe
See Also
.gif)