The information in this article applies to:
SUMMARYWhen calling methods on a COM server from within OnDraw() or a WM_PAINT message handler of an MFC client application, you may receive an HRESULT of 0x80010005 (RPC_E_CANTCALLOUT_INEXTERNALCALL - it is illegal to call out while inside message filter) as the return value of a COM call to a server. MORE INFORMATION
MFC has a default implementation of IMessageFilter(COleMessageFilter).
IMessageFilter is used by COM servers and clients to selectively handle
incoming and outgoing COM messages while waiting for a response from
synchronous calls. MFC's implementation allows processing of WM_PAINT
messages (to keep the UI updated) on the COM client side, while waiting on
a synchronous COM call to a server (for example, a call to an automation
method). This is done through IMessageFilter::MessagePending(). Thus, when
calling a COM server method inside of a WM_PAINT handler, you could already
be in the middle of a call to the server, and therefore receive the error
0x80010005.
For more information on how message filters work, please see the online
documentation on IMessageFilter and COleMessageFilter.
REFERENCES
"Inside OLE", second edition, by Kraig Brockschmidt, Chapter 6,
"Local/Remote Transparency," published by Microsoft Press. Additional query words: 80010005 2147549189 IMessageFilter MessagePending COleMessageFilter OnDraw kbvc420 kbvc500 kbvc600
Keywords : kbcode kbole kbMFC kbVC |
Last Reviewed: August 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |