BUG: "Invalid procedure call or argument" error message when you add a member variable by using the Class View Wizard in Visual C++ .NET

Article translations Article translations
Article ID: 822332 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

When you use the Add Member Variable Wizard in Visual C++ .NET to add a variable to a Dialog control, you may receive the following error messages:
Error: Invalid procedure call or argument
Visual C++ .NET 2003 Internet Explorer script error
An error has occurred in the script on this page. 
Line: 480 
Char: 4 
Error: Invalid procedure call or argument 
Code: 0 
URL: file://C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\VCWizards\MemVariableWiz\HTML\1033\default.htm
Visual C++ .NET 2002 error
An error has occurred in the script on this page. 
Line: 480 
Char: 4 
Error: Invalid procedure call or argument 
Code: 0 
URL: file://C:\Program Files\Microsoft Visual Studio .NET\Vc7\VCWizards\MemVariableWiz\HTML\1033\default.htm

CAUSE

This is a bug in the automation code for the DialogID property. Whenever any custom enum definitions appear before the AFX IDD enum in the header file, the Add Member Variable Wizard cannot find the dialog resource ID in the first enum definition in the Microsoft Foundation Class Library (MFC) CDialog class and an error message is displayed.

RESOLUTION

Move any custom enum definitions after the IDD enum so that the IDD enum appears first in the file if you search from the top down.

The following code example shows how to add the custom enum definition after the IDD enum definitions:
enum { IDD = IDD_TESTDLG_DIALOG };
enum cust_enum{}; // Put the custom enum definition here.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Microsoft Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types click Visual C++ Projects, under Templates click MFC Application, and then name the application TestDlg.
  4. In the MFC Application Wizard, click Application Type, set the application type to Dialog Based, and then click Finish.
  5. On the View menu, click Class View.
  6. In the Class View dialog box, expand CTestDlg.
  7. Define the custom enum. To add the custom enum, double-click CTestDlgDlg.
  8. In TestDlgDlg.h, add the following custom enum definition:
    enum cust_enum{};
    before the line
    enum { IDD = IDD_TESTDLG_DIALOG };
  9. Right-click CTestDlgDlg, point to Add, and then click Add Variable. You may receive the error message that is mentioned in the "Symptoms" section of this article.
You may also notice the same problem when you add a variable for any class that derives from the CDialog class and for the class that has the custom enum definition before the IDD enum in the header file.

Properties

Article ID: 822332 - Last Review: December 29, 2005 - Revision: 2.1
APPLIES TO
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
Keywords: 
kberrmsg kbbug kbide kbwizard kbdlg kbpending KB822332

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com