Microsoft KB Archive/140252

= PRB: ClassWizard Disables Add Function & Add Variable Buttons =

Article ID: 140252

Article Last Modified on 12/2/2003

-

APPLIES TO

 The ClassWizard, when used with:  Microsoft Visual C++ 4.0 Professional Edition

 Microsoft Visual C++ 5.0 Learning Edition

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q140252

<div class="symptoms_section">

SYMPTOMS
If either the header (.h) or implementation (.cpp) file for a class is a read-only file, the following buttons will be grayed out in ClassWizard:
 * Add Function button on the Message Map tab.
 * Add Variable button on Member Variables tab.
 * Add Method and Add Property buttons on the OLE Automation tab.
 * Add Event button on the OLE Event tab.

In Visual C++, versions 5.0 and 6.0, the OLE Automation tab is named Automation, and OLE Event is now ActiveX Events. Also, the following additional buttons will be dimmed:
 * Delete Function button on the Message Map tab.
 * Delete Variable button on Member Variables tab.

Having a project's .odl file tagged as read-only causes the same behavior, and having the .clw file tagged as read-only produces this message:

The ClassWizard database <path to the .clw file> is read-only.

ClassWizard cannot continue.

<div class="cause_section">

CAUSE
This is by design. ClassWizard checks the attributes of the header and implementation files for a class when a class is selected from the Class Name combo box. If either file is read-only, ClassWizard can't add a new method, function, or variable to the file, so the buttons are disabled.

If the files are checked-in to a source management system such as Microsoft SourceSafe, they are read-only until they are checked out.

<div class="resolution_section">

RESOLUTION
A simple workaround is to remove the read-only attribute from those files. If the files are under source management, checking the file out removes the read-only attribute as well.

<div class="status_section">

STATUS
This behavior is by design.

Keywords: kbprb KB140252

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.