15.7. Specific Hints, Problems, etc

Microsoft Visual C++/Microsoft Foundation Classes


15.7. Visual C++/MFC 4.0 Specific hints, problems, etc..

15.7.1. Why aren't my windows being created in MFC 4.0?

The problem is probably that you are relying on one of the MFC 3.x and earlier registered window classes for the class name passed to your ::Create(). For example, a very popular way to create a window with a white background is to use "AfxViewOrFrame". In MFC 4.0, not only have all of the window class names been changed, but they also happen dynamically when needed!

The solution is to use AfxRegisterWndClass() and pass the results to Create(). Be sure to specify the right flags to get the desired results. Also check out tech note number 1, which has been revised for 4.0.

- [email protected], 1/20/96

15.7.2. How do I convert a VC++ 2.x makefile over to 4.x?

  1. Select File/Open...
  2. Select your *.mak file
  3. Select Open as: Makefile
  4. Select Open, then VC will offer you to convert it to a VC workspace - this is what you want.

15.7.3. ClassWizard has problems wiring controls to members in international 4.0 versions, what the heck do I do?

To test and see if you have the problem:

  1. In VC version 4.0 use the app wizard to create a dialog based application.
  2. Then use the dialog resource editor to add controls etc onto the dialog box generated above.
  3. Then fire up the class wizard to associate member variables to the added controls. The control ID's are NOT listed in the command ID windows (the IDCANCEL and IDOK are there and that's it!) of the member variables property page.

The control ID's ARE in the message map property page but not on the member variables property page! Huh?

The fix:

The fix is to change the language property of the dialog template (highlight the name of the dialog box in the resource window and click right mouse button). For me I had to change the language property from English (US) to English (Australian), only after doing this do the member variables of control's appear. I assume this property must match your Win95 chosen language, in any case the change fixed it for me and a German user who had the same problem.

[email protected], email, 12/13/95

15.7.4. VC++ 4.0 crashes all the time on me!!! HELP!?!?!?!?!

I haven't personally experienced these problems, but here's some solutions (some are probably wives tales) for solving the problems:

  1. Make sure you have downloaded the service update from: http://www.microsoft.com/visualc.
  2. If you're using subprojects, this is probably the culprit, they're very unstable.
  3. If you're using 200+ files, try and carve your project into DLLs.
  4. Try removing the .ncb file, this is where the ClassView info is stored.
  5. If you converted your project over from 2.x and are having problems - start fresh with a 4.0 project and insert your files into it.

15.7.5. How do I add components (not just classes) to the Component Gallery?

The APIs used for the Component Gallery have not been made public yet by Microsoft.

UPD!! 15.7.6. What is up with the Visual C++ 5.0 help system!?

It is widely known (at least everyone I talk to) that the VC++ 5.0 help system is very very bad! Microsoft replaced the wonderful, speedy RTF based WinHelp viewer system with an HTML based IE viewer system. Why is it slow? Well now you have to basically have a Alta Vista on your desktop to search since it is basically HTML. There is an indexing system, it is suppose to get better, but it is really bad right now.

Here's what I do…

  1. Remove all of the help files.
  2. Install Visual C++ 4.2, choose only the IDE and help file options. Install into some unique directory like c:\vc42_help.
  3. Now use VC++ 4.2 for help and VC++ 5.0 for compiles.

Sounds cheesy and it is, but the 5.0 help is really that bad if you are a heavy user like I am (not sure if that is a good or bad thing).

-scot

I use the InfoViewer as a separate application. The InfoViewer can be found on the MSDN CD-ROM as well as part of the Windows CE Handheld SDK. It is much easier to hit the button on the taskbar for InfoViewer and pop it open rather than click the tab for the InfoViewer pane (I should say pain...) in the Developer Studio. It is about as easy to copy and paste code than to say have both open in equally sized windows and type the stuff I see. We should all be getting used to copy and paste anyway by now.

Mark S. Roush <[email protected]>