BUG: You Cannot Set Properties for the Encoder Source Plugins By Using OleCreatePropertyFrame() (312914)
The information in this article applies to:
- Microsoft Windows Media SDK, version 7.0
- Microsoft Windows Media SDK, version 7.1
This article was previously published under Q312914 SYMPTOMS
The device, the screen capture, and the time compression plug-ins support property pages. You can display these property pages programmatically to permit a user to configure the plug-in. To display these pages in a program that is built on the Microsoft Windows Media Encoder SDK version 7.1, use the OleCreatePropertyFrame application programming interface (API) function.
The OleCreatePropertyFrame function stops responding when you do this:
- Call the OleCreatePropertyFrame function. A property page dialog box appears.
- Select a valid capture source, and then click either OK or Apply.
The result does not set the properties correctly, and the dialog box remains on the screen unchanged.
RESOLUTION
To work around this problem, paste the following code to write the properties directly to the property bag:
HRESULT CEncoder::Initialize()
{
.
.
.
CComBSTR bstrBuffer = "WindowTitle";
CComBSTR bstrTop = "Top";
CComBSTR bstrLeft = "Left";
CComBSTR bstrRight= "Right";
CComBSTR bstrBottom = "Bottom";
CComBSTR bstrFrame = "Frame";
CComBSTR bstrFlash = "FlashRect";
CComVariant valueProp;
CComVariant valueLeft;
CComVariant valueTop;
CComVariant valueRight;
CComVariant valueBottom;
CComVariant valueFrame;
CComVariant valueFlash;
valueProp = L"Inbox - Microsoft Outlook";
valueLeft = 0;
valueTop = 0;
valueRight = 1024;
valueBottom = 768;
valueFrame = 0.2000;
valueFlash.boolVal = VARIANT_TRUE;
valueFlash.vt = VT_BOOL;
IPropertyBag * pProgertyBag = NULL;
hr = pVidSrc->QueryInterface(IID_IPropertyBag, (void **)&pPropertyBag);
hr = pPropertyBag->Write(bstrBuffer,&valueProp);
hr = pPropertyBag->Write(bstrTop,&valueTop);
hr = pPropertyBag->Write(bstrLeft,&valueLeft);
hr = pPropertyBag->Write(bstrRight,&valueRight);
hr = pPropertyBag->Write(bstrBottom,&valueBottom);
hr = pPropertyBag->Write(bstrFrame,&valueFrame);
hr = pPropertyBag->Write(bstrFlash,&valueFlash);
// Prepare To Encode
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
return hr;
}
Setting the Screen Capture Codec
Programmatically setting the screen capture codec can take the following parameters. |
VT_BSTR | WindowTitle | Inbox - Microsoft Outlook. The title of the window, which is used to capture a program window. | VT_I4 | Capture Window | 0. Capture a full screen or a region of a screen. HWND. Capture a specific program window. | VT_I4 | Left | 0. The value is filled in automatically if capturing a program window. | VT_I4 | Top | 0. The value is filled in automatically if capturing a program window. | VT_I4 | Right | 1024. The value is filled in automatically if capturing a program window. | VT_I4 | Bottom | 768. The value is filled in automatically if capturing a program window. | VT_R8 | FrameInterval | 0.2000. Frame Rate (seconds/frame). For example, 0.2 = 5 fps. | VT_BOOL | FlashRect | VARIANT_TRUE. Flash the capture region. VARIANT_FALSE. Do not flash the capture region. |
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. REFERENCES
For more information about plug-in property pages and the sample of code that is mentioned in the "Resolution" section, see the MSDN online Help documentation:
Modification Type: | Minor | Last Reviewed: | 2/11/2004 |
---|
Keywords: | kbDSWMM2003Swept kbbug kbinfo kbnofix KB312914 |
---|
|