Click to See Complete Forum and Search --> : How to add a message map to a class generated manually OR import a class w/mm from outside and get i


Jeet
April 26th, 1999, 05:22 AM
I searched the archives, but came up with nothing. So if this has been covered before (and, since it is a very basic questio, I suspect that it has), I apologize and please direct me to the correct URL.

I am trying to right a general-purpose view class that will be able to handle windows messages. Simple right? Basically: call up the ClassWizard, then, onthe Message Maps tab, click on Add, then Add class, then New etc.. Basically jump through the hoops, and you have your class sitting there, nice and pretty, ready to use -- right click on it in the ClassView window, and you get the option to add a virtual function or windows message handler.

Great.

Now, what I want to do is to be able to use this class in other projects. In particular, I want to be able to zip up the .cpp and .h files, keep them on storage, and whenever I need this class's functionality just extract/copy them into the new project's directory and add them into the project. All this works fine, and I can compile etc., ... but no matter what I do, I cannot get the class wizard to acknowledge the fact that the inserted class has a message maps capacity!!! Right clicking on the class in the ClassViewer does NOT have the option of adding a windows message handler or virtual function (only adding member functions, variables etc.), and the class does NOT appear in the drop down list of classes in the Message Map tab of the ClassWizard. There is no option for me to use a ready-existing class when I want to add classes to the Message Map tab of the ClassWizard (the choice is limited to creating a new class or deriving one from a template).

Anyone know what I should do?

Thanks in advance!

Joerg Nowak
April 26th, 1999, 08:07 PM
The class wizard configuration file has the extension 'clw' and is in your project diectory . If you delete this file the next time that you try to run class wizard it will ask you to rebuild the class wizard information. Click 'yes' and that should do it.

Remember also that in order for the class to appear in the IDE it has to be explicitly declared as belonging to the project (use the add files function int he project menu) And Finally in order for message maps to be used the class in question has to be derived from some form of CWnd.

Hope This helps
Joerg