The MFC AppWizard generates incorrect toolbars and bitmaps (190518)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q190518 SYMPTOMS
The MFC AppWizard (exe) has the following problems when generating
applications that do not support the Document/View architecture:
- SDI applications that do not support the Document/View architecture have
disassociations between their toolbar buttons and their images. These
disassociations also exist when Context-sensitive help is supported.
- MDI applications that do not support the Document/View architecture but
have Context-sensitive Help do not have a Help toolbar image.
CAUSE
The MFC AppWizard uses the same toolbar bitmap for both SDI and MDI
applications that do not support the Document/View architecture. This
bitmap is also used when Context-sensitive help is selected in MFC
AppWizard step 4. This bitmap does not contain the Help toolbar image.
In the case of SDI applications, there is no File New toolbar button
generated. This causes a disassociation between the toolbar buttons and
their images. For example, the Help About toolbar button has the Print
image on it. When Context-sensitive help is selected, the Help toolbar
button has the Help About image on it.
RESOLUTIONSDI Applications That Do Not Support the Document/View Architecture
Add a File New toolbar button by modifying the applications resource
File:
On the File menu, click Open, and open the applications resource file.
Select <yourapp>.rc file and specify OpenAs Text. Add the following to
the Toolbar section:
.
.
//////////////////////////////////////////////////////////////////
// Toolbar
IDR_MAINFRAME TOOLBAR DISCARDABLE 16, 15
BEGIN
BUTTON ID_FILE_NEW //<-Add the File New toolbar button.
SEPARATOR //<-Add a toolbar separator.
BUTTON ID_EDIT_CUT
BUTTON ID_EDIT_COPY
BUTTON ID_EDIT_PASTE
SEPARATOR
BUTTON ID_FILE_PRINT
SEPARATOR
BUTTON ID_APP_ABOUT
END
.
.
SDI Applications Without Document/View Architecture but Support Help
Make the above modifications as well as modifying the applications toolbar
bitmap. You'll need to export a bitmap from the MFC AppWizard resource DLL,
which has a Help toolbar image:
- On the File menu, click Open, and open the MFC AppWizard resource DLL.
Navigate to the ..\MSDev98\bin\ide directory. Select Mfcapwz.dll and
specify OpenAs Resources. Click Ok.
- Expand the Template directory, right-click Tbah_.bmp, and click Export.
Specify a name and directory for the bitmap, and click Export.
- On the File menu, click Open from the main menu and navigate to the
directory where you saved the bitmap. Double-click the bitmap to open it
in the resource editor.
- In the Graphics window, select the Rectangle Selection tool if it is not
already selected. Using the mouse, select the Help image by dragging the
mouse over it. On the Edit menu, click Copy.
NOTE: Toolbar button images are 16x15 pixels in size. The area you
select should be 16x15 and can be verified in the status bar.
- In ResourceView, expand the Toolbar folder. Double-click IDR_MAINFRAME
to open the Toolbar editor. Select the empty button to the left of the
Help About button. On the Edit menu, click Paste. Click the Help About
toolbar button. The Help image should now be on the Help toolbar
button.
- Save IDR_MAINFRAME and rebuild the application.
MDI Applications Without Document/View Architecture but Support Help
Make the above modifications to include the Help image in your applications
toolbar bitmap.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022
Visual Studio 6.0 service packs, what, where, why
194295 How to tell that a Visual Studio service pack is installed
REFERENCES
See the following online documentation:
- "Creating a Custom AppWizard:" Visual C++ Documentation, Using Visual C++,
Visual C++ Programmer's Guide, Beginning Your Program, Creating a Custom
AppWizard.
- "Toolbar Editor:" Visual C++ Documentation, Using Visual C++, Visual C++
User's Guide, Resource Editors, Toolbar Editor.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
190977
BUG: Custom AppWizard generates incorrect toolbars and bitmaps
Modification Type: | Major | Last Reviewed: | 5/26/2005 |
---|
Keywords: | kbtshoot kbProgramming kbBug kbFAQ kbfix kbide kbVS600sp3fix kbwizard KB190518 kbAudDeveloper |
---|
|