ID: Q121522
1.50 1.51 WINDOWS kbole kbfixlist kbbuglist kbprg kbtshoot
The information in this article applies to:
- Microsoft Visual C++ for Windows, versions 1.5 and 1.51
Any call to COleServerDoc::XDataObject::SetData will return the HRESULT corresponding to the error SCODE E_OUTOFMEMORY.
This is due to a missing line in the source code's TRY block that should set sc=S_OK if no exception is thrown.
Add the line sc=S_OK to the end of the TRY block in the code sample shown in the More Information section. (Currently, the sc=S_OK line appears as a comment in the sample code.) Then and recompile the MFC libraries using the supplied MAKEFILE in the \MSVC\MFC\SRC directory of your Visual C++ installation.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 1.52 for Windows.
/* Compile options needed:
*/
STDMETHODIMP COleServerDoc::XDataObject::SetData(
LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium, BOOL fRelease)
{
METHOD_PROLOGUE(COleServerDoc, DataObject)
ASSERT_VALID(pThis);
COleServerItem* pItem;
SCODE sc = E_OUTOFMEMORY;
TRY
{
pItem = pThis->GetEmbeddedItem();
ASSERT_VALID(pItem);
ASSERT(pItem->IsKindOf(RUNTIME_CLASS(COleServerItem)));
// missing sc=S_OK; here
}
END_TRY
if (sc != S_OK)
return ResultFromScode(sc);
return pItem->GetDataObject()->SetData(lpFormatEtc,
lpStgMedium,fRelease);
}
Additional reference words: 1.50 1.51 2.50 2.51
KBCategory: kbole kbfixlist kbbuglist kbprg kbtshoot
KBSubcategory: MfcOLE
Keywords : kbole kbMFC kbVC kbbuglist kbfixlist
Version : 1.50 1.51
Platform : WINDOWS
Solution Type : kbfix
Last Reviewed: September 20, 1997