Solved

Debugging 2 MFC exes at once.

Posted on 2000-02-23
10
242 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
  • 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 200 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Prevent this page from creating additional dialogs. 3 532
Hibernate methods 2 72
VBA "SendKeys" Syntax for Multiple Keystrokes 7 108
canBalance challenge 34 85
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

809 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