SIMPSVR Implements IDataObject::GetData Incorrectly

ID: Q114599

2.01 WINDOWS kbole kbprg

The information in this article applies to:

The simple server sample application (SIMPSVR.EXE) included with the OLE 2.01 SDK incorrectly implements the IDataObject::GetData() method. The code checks the cfFormat member of the FORMATEC structure to see if the format is CF_BITMAP. If so, the code continues, filling out the STGMEDIUM with a METAFILEPICT. The code should be comparing the cfFormat with CF_METAFILEPICT.

The sample code continues to work correctly because the STGMEDIUM structure is filled out appropriately for CF_METAFILEPICT. The default handler puts the information into the cache based on the value that is returned, rather than on the value that is requested.

The sample code included with Visual C++ for Windows version 1.5x has been corrected. It now compares against CF_METAFILEPICT.

Additional reference words: 2.01 KBCategory: kbole kbprg KBSubcategory: LeTwoSvr Keywords : kb16bitonly

Last Reviewed: July 24, 1997