IWMEncProfileManager::get_LastCreatedProfile
![]() |
The get_LastCreatedProfile method retrieves the name of the profile most recently created by the end user during the current encoding session.
Syntax
HRESULT get_LastCreatedProfile(
BSTR* bstrProfile
);
Parameters
bstrProfile
[out] Pointer to a BSTR containing the profile name.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
| Return code | Number | Description |
| E_POINTER | 0x80004003 | The pointer to the profile is NULL. |
Remarks
You can use the get_LastCreatedProfile method to determine whether an end user has created a profile with the Profile Manager. The variable containing the name of the profile is reset when you call IWMEncProfileManager::WMEncProfileList.
Example Code
// Include libraries.
#include <windows.h>
#include <atlbase.h> // Includes CComBSTR.
#include "wmencode.h"
// Declare variables.
HRESULT hr;
IWMEncProfileManager* pProfileMgr;
// Initialize the COM library and retrieve a pointer
// to an IWMEncProfileManager interface.
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncProfileManager,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncProfileManager,
(void**) &pProfileMgr);
}
CComBSTR bstrLastProfile("");
CComBSTR bstrProfileDirectory("");
CComBSTR bstrDetailsString("");
CComBSTR bstrProfileName("Windows Media Video 8 for Local Area Network (384 Kbps)");
// Display the dialog box that lists the profiles. Because
// you are calling WMEncProfileListEx() rather than WMEncProfileList()
// and have indicated that a new profile is audio only, if you
// open the New profile dialog box, only the audio check box is selected.
if ( SUCCEEDED( hr ) )
{
hr = pProfileMgr->WMEncProfileListEx(WMENC_FILTER_AV,
WMENC_FILTER_A,
0);
}
// Display the New Profile dialog box. If you supply the name of an
// existing profile, the new profile will be a copy of that profile.
if ( SUCCEEDED( hr ) )
{
hr = pProfileMgr->WMEncProfileEdit(bstrProfileName,
WMENC_FILTER_AV,
0);
}
// Retrieve a string containing the details of a specific profile.
if ( SUCCEEDED( hr ) )
{
hr = pProfileMgr->GetDetailsString(bstrProfileName,
0,
&bstrDetailsString);
}
// Retrieve the name of last profile created by the end user
// during the current encoding session.
if ( SUCCEEDED( hr ) )
{
hr = pProfileMgr->get_LastCreatedProfile(&bstrLastProfile);
}
// Retrieve a string containing the path of the directory in which
// custom profiles are stored.
if ( SUCCEEDED( hr ) )
{
hr = pProfileMgr->get_ProfileDirectory(&bstrProfileDirectory);
}
// Release pointers.
if ( pProfileMgr )
{
pProfileMgr->Release();
pProfileMgr = NULL;
}
Requirements
Header: wmencode.h
Library: wmenc.exe
See Also
.gif)