Microsoft KB Archive/311407

From BetaArchive Wiki
Knowledge Base


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

Article ID: 311407

Article Last Modified on 6/25/2003



APPLIES TO

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



This article was previously published under Q311407

SYMPTOMS

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>

CAUSE

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.

RESOLUTION

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.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

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.


Additional query words: Excel DialogBox

Keywords: kbbug kbpending KB311407