Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Debugging 2 MFC exes at once.

Posted on 2000-02-23
10
Medium Priority
?
257 Views
Last Modified: 2013-11-20
Hi,

I am trying to run an exe that launches another exe, but I would like to be able to debug both.? I have tried debugging the second exe (the one that is launched) and setting the first exe as the executable to run, but it still makes my break points in the second application invalid.

Cheers!

Emma
0
Comment
Question by:middlel
[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
  • 5
  • 4
10 Comments
 
LVL 8

Expert Comment

by:VinExpert
ID: 2549644
Hi,

I dont think it is possible. If yes, then it will be a new technique for me!!!

VinExpert
0
 
LVL 4

Accepted Solution

by:
captainkirk earned 600 total points
ID: 2551119
try this:

long lRetVal = ERROR_SUCCESS;

if ((lRetVal = (long) ShellExecute(NULL, _T("open"), _T("msdev.exe"),
_T("d:\\somewhere\\YourProgram.exe"),
_T("d:\\somewhere\\"), SW_SHOW)) < 32)
{            
    CString csMsg = _T("ShellExecute() failure... check for existence of application ");
AfxMessageBox(csMsg, MB_OK | MB_TOPMOST, NULL);
} // end if



this will bring up msdev - when it does, select the build/start debug menu item for your shelled application...now you can set up breakpoints, etc....

hope that helps...
0
 

Author Comment

by:middlel
ID: 2551148
I have them both in msdev already... are you telling me to run it from the command line..?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:captainkirk
ID: 2551425
The first msdev runs your program which launches the second program, only instead of launching the program, it launches msdev, set to run your original second program ... now you can debug both... it requires that you substitute the above code (or a modification thereof) for the code that launches your second program...

I hope I'm understanding the problem correctly...
0
 

Author Comment

by:middlel
ID: 2553676
I like your style :-).. I'll try it and let you know.. I hope it works because it is proving very difficult to write two programs that interact so closely because you are never quite sure where the problems are..

thanks
0
 

Author Comment

by:middlel
ID: 2553733
Where do I put the code you mentioned? I tried launching msdev from the project settings loading up my first program which seemed to work, but I couldn't set breakpoints in the first msdev then?!?!?

thanks again..

Emma
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2555056
How and where does your first program launch the second one??? I just provided code that uses ShellExecute() - yours could be using one of the spawn functions, or even through COM/DCOM with a CoCreateInstance() call. Could you provide specifics???

0
 

Author Comment

by:middlel
ID: 2555078
My first app launches the second using CreatePRocess().
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2556032
1) try setting "msdev" as the exe to run in your CreateProcess() call and the name of your second program as a parameter to it. Of course, the second program should have been compiled in debug mode.

2) when the CreateProcess() call runs, it should bring up another copy of msdev with your second program associated with it, but not yet running.

3) now you can use the Build/Start Debug menu selection to start the second program (I recommend "Step Into" so that you can open the source file you want to set breakpoints in and then "Go".

4) Both programs are now being debugged...

0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2612662
thanks, Emma - hope your project is working out OK...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

636 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