Knowledge Base

SIMPSVR Implements IDataObject: GetData Incorrectly

Article ID: 114599

Article Last Modified on 3/3/2005


APPLIES TO


This article was previously published under Q114599
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 query words: 2.01

Keywords: kb16bitonly KB114599