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.

TypeNameUsage
VT_BSTRWindowTitleInbox - Microsoft Outlook. The title of the window, which is used to capture a program window.
VT_I4Capture Window0. Capture a full screen or a region of a screen.
HWND. Capture a specific program window.
VT_I4Left0. The value is filled in automatically if capturing a program window.
VT_I4Top0. The value is filled in automatically if capturing a program window.
VT_I4Right1024. The value is filled in automatically if capturing a program window.
VT_I4Bottom768. The value is filled in automatically if capturing a program window.
VT_R8FrameInterval0.2000. Frame Rate (seconds/frame). For example, 0.2 = 5 fps.
VT_BOOLFlashRectVARIANT_TRUE. Flash the capture region.
VARIANT_FALSE. Do not flash the capture region.

STATUS

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

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Compile and run the sample code that is available from the link in the "References" 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.

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:MinorLast Reviewed:2/11/2004
Keywords:kbDSWMM2003Swept kbbug kbinfo kbnofix KB312914