Having some problems with presenting the available devices for a Windows Media Encoder session and showing the properties for a specific device. In the Windows Media Encoder SDK you will find the following code on how to display property pages for plug-ins:
if ( SUCCEEDED( hr ) )
{
hr = pPlugin->QueryInterface(IID_ISpecifyPropertyPages,
(LPVOID*)&pPages);
}
if ( SUCCEEDED( hr ) )
{
hr = pPages->GetPages( &uuid );
}
// Invoke a dialog box to display.
if ( SUCCEEDED( hr ) )
{
hr = OleCreatePropertyFrame
(
m_hWnd, // You must create the parent window.
200, // Horizontal position for the dialog box.
200, // Vertical position for the dialog box.
CComBSTR("name"), // String used for the dialog box caption.
1, // Number of pointers passed in pPlugin.
&pPlugin, // Pointer to the plug-in.
uuid.cElems, // Number of property pages.
uuid.pElems, // Array of property page CLSIDs.
LOCALE_USER_DEFAULT, // Locale ID for the dialog box.
0, // Reserved.
NULL // Reserved.
);
}
When you first run this code you will quickly find out that this is not really working. To make it work you need to change this a little bit:
if ( SUCCEEDED( hr ) )
{
hr = pPlugin->QueryInterface(IID_ISpecifyPropertyPages,
(LPVOID*)&pPages);
}
if ( SUCCEEDED( hr ) )
{
hr = pPages->GetPages( &uuid );
}
IUnknown* pPPObjectUnk = NULL;
if(SUCCEEDED(hr))
{
hr = pPages->QueryInterface(IID_IUnknown, (LPVOID*)&pPPObjectUnk);
}
// Invoke a dialog box to display.
if ( SUCCEEDED( hr ) )
{
hr = OleCreatePropertyFrame
(
m_hWnd, // You must create the parent window.
200, // Horizontal position for the dialog box.
200, // Vertical position for the dialog box.
CComBSTR("name"), // String used for the dialog box caption.
1, // Number of pointers passed in pPlugin.
&pPPObjectUnk, // Pointer to the plug-in.
uuid.cElems, // Number of property pages.
uuid.pElems, // Array of property page CLSIDs.
LOCALE_USER_DEFAULT, // Locale ID for the dialog box.
0, // Reserved.
NULL // Reserved.
);
}
if(pPPObjectUnk)
{
pPPObjectUnk->Release();
pPPObjectUnk = NULL;
}