FIX: SetData Always Returns E_OUTOFMEMORYLast reviewed: September 18, 1997Article ID: Q121522 |
1.50 1.51
WINDOWS
kbole kbfixlist kbbuglist kbprg kbtshoot
The information in this article applies to:
SYMPTOMSAny call to COleServerDoc::XDataObject::SetData will return the HRESULT corresponding to the error SCODE E_OUTOFMEMORY.
CAUSEThis is due to a missing line in the source code's TRY block that should set sc=S_OK if no exception is thrown.
RESOLUTIONAdd 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.
STATUSMicrosoft 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.
REFERENCES
Sample Code
/* 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |