Link to home
Create AccountLog in
Avatar of dharm0us
dharm0us

asked on

integrating two vc++ projects(which use cdialog)

Hi,
Say I have two vc++ projects using MFC. Both of the applications when launched, show a dialog.
Now, If I want to integrate them in the following manner:
(1) I should be able to combine them in a single vc++ project,
     so that I have only one exe.
(2) I should be able to launch any of the above applications
     from a third dialog, in the same project.

How can it be done?
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of dharm0us
dharm0us

ASKER

I tried that.
Here is what I did:
I merged the two *.rc files and resource.h files(not simply copy-pase, but a careful merge), and included the *.cpp and *.h files in the new project. but the project even failed to load, when I tried to open it.
and then when I tried to compile it, it gave an error like:
cannot write to *.pch file due to insufficient system resources.

as for the second option, we can assume it's not allowed. I need only one exe.
The pch is the pre-compiled header file.  You can safely delete it (in fact a rebuild all should delete it without you having to).

Just try a rebuild all on the project.  Does that help in any way?
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
yeah, here is a final comment by me.
anyone who wishes to do such a thing, should do this:
"carefully" merge thse files:
1. *.clw for both the projects.
2. resource.h for both the projects.
3. *.rc for both the projects

1.
In *.clw you will have to yourself edit
ClassCount = ..
and
LastClass=..  


2.
while modifying resource.h, you will have to assign the different numbers manually, in the increasing order and you will also have to edit, thse two:
#define _APS_NEXT_RESOURCE_VALUE      
#define _APS_NEXT_CONTROL_VALUE      

Just delete the .clw file.  When you run class wizard it will be rebuilt for you - much simpler than editing it yourself.
I am not sure about this.
Since .clw file is the only place where you can specify
which dialog uses which class.
If you don't copy that information from the other .clw file,
you will have to specify in class wizard which class do you want to associate with each dialog.
OK, try this.
Make a copy of your project.
In the original delete the .clw file.
Start VC.
Start the class wizard.
see what happens.
yes, it works.
but why?
Is it because in the .h file of a given class,
I specify the dialog ID?
The clw file is a file the class wizard builds from information in the other files in the project.  It is to help the class wizard and its contents are updated as you make changes to the other files in the project.