We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

integrating two vc++ projects(which use cdialog)

dharm0us
dharm0us asked
on
Medium Priority
338 Views
Last Modified: 2013-11-20
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?
Comment
Watch Question

AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT
Commented:
Two methods spring to mind.
Copy/Paste the resources and code you want into a new project so you have the functionality of both current apps but within one exe.
OR more simply create a third exe that works with the existing ones.
Create a new project that launches either of the existing apps (eg. ShellExecute, CreateProcess).

Which sounds most interesting?

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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?
IT Professional
Top Expert 2005
Commented:
Opening resource files and copying dialog resources from existing to new one and write code accordingly will be better.

MAHESH

Author

Commented:
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      

AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
Just delete the .clw file.  When you run class wizard it will be rebuilt for you - much simpler than editing it yourself.

Author

Commented:
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.
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
yes, it works.
but why?
Is it because in the .h file of a given class,
I specify the dialog ID?
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
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.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.