Microsoft KB Archive/312914

= BUG: You Cannot Set Properties for the Encoder Source Plugins By Using OleCreatePropertyFrame =

Article ID: 312914

Article Last Modified on 2/11/2004

-

APPLIES TO


 * Microsoft Windows Media Software Development Kit 7.0
 * Microsoft Windows Media Format Software Development Kit 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 = &quot;WindowTitle&quot;; CComBSTR bstrTop = &quot;Top&quot;; CComBSTR bstrLeft = &quot;Left&quot;; CComBSTR bstrRight= &quot;Right&quot;; CComBSTR bstrBottom = &quot;Bottom&quot;; CComBSTR bstrFrame = &quot;Frame&quot;; CComBSTR bstrFlash = &quot;FlashRect&quot;;

CComVariant valueProp; CComVariant valueLeft; CComVariant valueTop; CComVariant valueRight; CComVariant valueBottom; CComVariant valueFrame; CComVariant valueFlash;

valueProp = L&quot;Inbox - Microsoft Outlook&quot;; 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.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior

 * 1) Compile and run the sample code that is available from the link in the &quot;References&quot; section.
 * 2) In the Capture Sources box, select any item except Entire Screen, Region of Screen, or Window.
 * 3) Click either OK or Apply. The expected behavior does not occur.

