The information in this article applies to:
SYMPTOMSWhen using DISP_DEFVALUE to specify a default property in an MFC IDispatch interface, properties and methods declared with one of the DISP_XXXX_ID macros fails if the DISPID specified is one greater than the last ID generated by MFC. CAUSE
MFC maintains a table of dispatch entries, which it searches when methods
and properties are accessed through IDispatch::Invoke. Because items placed
in the dispatch map without using DISP_XXXX_ID macros do not have DISPIDs
associated with them internally, MFC relies on the order in which they are
placed in the table.
RESOLUTION
Remove the default property, or specify a DISPID in the DISP_XXXX_ID macro
that is at least 2 greater than the number of properties and methods in the
dispatch map not specified using the DISP_XXXX_ID macros.
2 + (# of Dispatch Map entries) - (# of DISP_XXXX_ID entries) = DISPID of first DISP_XXXX_ID macroIf you need to specify a default property and assign to a property or method a low value DISPID, you may need to use DISP_XXXX_ID macros for all of the methods and properties in the dispatch map. STATUSThis feature is by design. MORE INFORMATIONAlthough ClassWizard maintains dispatch IDs for properties and methods in the .odl file, DISPIDs are not specified for entries in the dispatch map unless they are specified manually using one of the DISP_XXXX_ID macros:
REFERENCESFor more information on MFC's dispatch maps, DISP macros, and default DISPID numbering, see MFC Technote #39 in the Visual C++ documentation. © Microsoft Corporation 1998, All Rights Reserved. Additional query words: automation
Keywords : kbole kbMFC kbVC500 |
Last Reviewed: January 12, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |