FIX: SetData Always Returns E_OUTOFMEMORY |
Q121522
1.50 1.51 WINDOWS kbole kbfixlist kbbuglist kbprg kbtshootAny 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 query words: 1.50 1.51 2.50 2.51
Keywords : kbole kb16bitonly kbActiveX kbAutomation kbCOMt kbLocalSvr kbMFC kbVC150bug kbVC151bug kbVC152fix kbGrpDSMFCATL
Issue type : kbbug
Technology : kbAudDeveloper kbMFC
|
Last Reviewed: May 5, 2001 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |