[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

linking 2 projects?

Posted on 1998-09-22
12
Medium Priority
?
199 Views
Last Modified: 2013-11-19
dear experts,
i did 2 projects and saved them in 2 different folder(workspace) or whatever it is called. how do i connect the two? i want to put a menu item in one of the project, when click on the menu item will open the second project. i hope this question is clear enough. pls mail me if u need more info to answer this question. i desperately need help here.
keanclaude@yahoo.com

0
Comment
Question by:kean082198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322422
can you explain if this "link" is supposed to be at runtime or compile time.

If it's runtime

i. Add a menu option to project A
ii. Add a handler function for the menu in project A
iii. In the handler WinExec( "projectb.exe", SW_SHOWNORMAL ) ; to run the second project.  I recommend checking the return value (<=32 is an error)
0
 

Accepted Solution

by:
antonio_m_barros earned 150 total points
ID: 1322423
On the other hand, if "link" is having both projects opened then

i) Select one of the workspaces
ii) Insert the other project into the first workspace (Menu Project, option Insert Project into Workspace)
iii) with the build toolbar visible, you will see a combobox (the first one) that will allow you to change from one project to the other, in teh same workspace.

0
 

Author Comment

by:kean082198
ID: 1322424
dear answer2000 and barros',
what i meant was that, i want a menu item on project A, when clicked will open project B to be run during the run time. well, i want to make an exe file out of it so i can combine the two files together( is this called run time?).
i thought it was like clicking the menu item to open a dialog box for input of data?, but in this case just opening the other project only?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kean082198
ID: 1322425
dear answer2000
what do you mean by checking the return value?
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322426
Are A and B both EXEs ?  My original comment assumed they were.  To expand on this

(you also said in a dummy question:

"Dear answer2000,
i think i you know what i mean here. can you please give me the more detailed solution onto how to do it. what is the complete code that is needed to write in the message handler in the project A. is it that i put it in the CMAinFrm.cpp or in the CView.cpp class? "

You can add the menu option to run another program, in either of the places you mentioned, or in the document.   MFC will handle it for you.  The normal way to choose where to put it would be:

(1) In the frame: if the menu option is available all the time (even if no documents are open)

(ii) In the document: if the menu option applies the same to all views of all documents

(iii) In the view: if the menu option applies to only a particular view (for example you may have 2 views of the same document which are supposed to react differently).

If you have an SDI app (1 doc, 1 view) it doesn't really matter.

Okay here's what to do
A. Add the menu option to your resources.
B. Use Class Wizard to add the handler for the menu option to your chosen class (you'll see a list of menu options in the "Object Ids" list box on message maps, add a "COMMAND" handler).
C. You'll get a function added to the bottom of the C++ file something like

void CMyMainFrame::OnFileRun()
{
      // TODO: Add your command handler code here
      
}


Inside the brackets put the code to run the second program, example:

void CMyMainFrame::OnFileRun()
{
   UINT nError = WinExec( "C:\SOMEDIR\B.EXE", SW_SHOWNORMAL ) ;

   if ( nError <= 31 )
   {
       CString strError ;
       strError.Format( "Couldn't start B\n\nError %u", (unsigned)nError ) ;
       AfxMessageBox( strError ) ;
   }
}

0
 

Author Comment

by:kean082198
ID: 1322427
dear answer2000,
i followed exactly what you told me to do. i put the menu item
added a msg handler then put in the codes. but the error box came out
instead.
must i put the second project in the first project first?
or should i import it inside my first project.

please explain further.
what came out was...error 2???

my second project name is saved in this folder:
D:\ProgramFiles\DevStudio\MyProjects\Signature

please tell me what is my next step. i am quite weak in this
programming language.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322428
Remember the EXE from the 2nd project is not necessarily where you think it is

Typically the output from a project goes into a DEBUG or RELEASE directory, which is a subdirectory of the main project directory

Make sure you specify the path to the 2nd EXE correctly (you can look where it is by using Windows Explorer after building the 2nd project), or put both EXEs in the same directory (WinExec without just the EXE name e.g. "B.EXE" will work if this is the case)

Incidentally I notice you accepted antonio's answer - you don't have to accept the first answer that comes along - this was a mistake - right?
0
 

Author Comment

by:kean082198
ID: 1322429
dear ans2000,
thk you for all yr help. i didn't realise tht i accepted his answer. anyway, u have been great in identifying my error!
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322430
i shall ignore the dummy Q's unless you tell me otherwise
0
 

Author Comment

by:kean082198
ID: 1322431
dear ans2000,
one real dummy question....how do i go abt giving points to you? i feel that i really need to acknowledge your effort here. i manage to open the second project already..all thanks to you.
thank you very much. i really appreaciate all that u have done!
how can i personally thank you...?
kean
0
 

Author Comment

by:kean082198
ID: 1322432
dear answer2000,

is it possible to insert a picture in my dialog box, to enhance the
appearance of it? i know it is pretty simple to do it in visual basic
but i don't know how to do it in visual c++.
please give me some tips. i have the picture that i wanted to paste
in my dialog box saved in a file. please advice me on how to do it?
i just want to make the appearance better.
thank you.
btw, the linking of the files works fine.

kean
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322433
hi kean - I'll post this in all 3 Qs you have relating to "linking to 2 projects" although this follow up original came from "linking 2 projects Q"

>> one real dummy question....how do i go abt giving points to you? i feel that i really need to acknowledge your effort here. i manage to open the second project

I'll look the 2 dummy Qs you made.  You can then give me a grade if you like either (a) for both or (b) reject one and grade one, or (c) even if you want create another dummy if you want to allocate more

>> is it possible to insert a picture in my dialog box,
 Regarding the picture.
1.  Insert a bitmap on icon into your resources
2. Add a text control to the dialog resources
3. You can set the text style in resources to shown the picture.  Quite a few options there
If you have more Qs on this, you really should open up a new question, as I or other experts may not spot it a "dead" question like linking 2 projects



0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question