BUG: MFC Class Wizard Does Not Resolve Naming Conflicts Between Windows APIs and COM Interface Methods

This article was previously published under Q311407
This article has been archived. It is offered "as is" and will no longer be updated.
If you use the Microsoft Foundation Classes (MFC) Add Class from TypeLib wizard in Microsoft Visual Studio .NET to add a wrapper class for a Component Object Model (COM) interface, and the interface contains a method with the same name as a Microsoft Windows application programming interface (API), you may receive a compile-time error message such as the following when you compile the project:
Warning C4003: Not enough actual parameters for macro <Method Name>
The Add Class from TypeLib Wizard fails to recognize that the COM interface for which it generates a wrapper class contains methods whose names conflict with existing macro names for Windows APIs.
To work around the problem, locate the line that is specified in the error message and add an underscore (_) to the method name that is causing the conflict, then save the file and recompile the project.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Previous versions of MFC correctly recognized this condition and appended an underscore (_) to the method name in the wrapper class, avoiding the name conflict while maintaining the functionality of the wrapper class.
Excel DialogBox

Article ID: 311407 - Last Review: 01/17/2015 00:12:50 - Revision: 1.2

Microsoft Visual C++ .NET 2002 Standard Edition, Microsoft Visual C++ .NET 2003 Standard Edition

  • kbnosurvey kbarchive kbbug kbpending KB311407