HowTo : How to use generated classes in .NET MFC like in VS6 MFC
Article | 41024043 |
Type | HowTo |
Product | Engine |
Version | 5.1.1.1037 |
Date Added | 7/6/2005 |
Submitted by | Mike Stoodley |
Keywords | |
Subject
How to use generated classes in .NET MFC like in VS6 MFC
Summary
How to use generated classes in .NET MFC like in VS6 MFC
Solution
The solution in your problem is the following:
1) Make a temporary dialog based project using VS6 with a name of project "_vdfiles".
2) Use the procedure you described (Project->Add To-> Project->Components and Controls) to add the necessary files for VectorDraw classes. The files that will be generated are vd*.cpp,vd*.h,font.cpp,font.h,picture.cpp and picture.h.
3) Create a new project in .NET (Visual C++ projects->MFC->MFC application - dialog based for example).
4) In the dialog form, right click and select insert activeX control and choose the VectorDraw control.
5) Copy all the previous generated files (from step 2) in the new .NET project folder.
6) In solution explorer, right click on the project and select "add existing item". Select the files that you copy in the step 5.
7) Open the .h file of your dialog class and in the top of the file add the following line: #include "vdraw.h"
8) In resource view explorer, open the form and right click on it and select "Add Variable".
9) Check on the "Control variable" check box and in the "Control ID" box select the "IDC_VDPRO1". In the "Variable type" write "CVdraw". In the "Variable name" give a name (for example m_vdraw) and select finish.
Now you can use the same classes with the same way as exactly in VS6.
If you want to upgrade the .NET project with a new patch of VectorDraw then you must always keep the temporary VS6 project (step1).
1) Download the new patch, register the ocx and dll's
2) Open the project from step 1 with VS6
3) Use the procedure you described (Project->Add To-> Project->Components and Controls) to add the necessary files for VectorDraw classes. The files that will be generated are vd*.cpp,vd*.h,font.cpp,font.h,picture.cpp and picture.h.
4) Copy all the previous generated files (from step 3) in the existing .NET project folder.
5) Open the .NET project and rebuild it.