Debugging Spawned Applications in Visual C++

ID: Q118683


The information in this article applies to:


SUMMARY

This article describes how to debug an application that is spawned (executed) from another application within the Visual Workbench for Windows.


MORE INFORMATION

The sample code below contains the source for files PROG_A.EXE and PROG_B.EXE. To debug PROG_B.EXE, which is spawned from PROG_A.EXE, perform the following steps:

  1. Load PROG_A.MAK, making sure that it is up to date.


  2. Choose Debug from the Options menu.


  3. Type "PROG_B.EXE" in the Additional DLLs field of the Debug dialog box.


  4. From the Files menu, open the PROG_B.CPP file and put a breakpoint on the output line.


  5. Press F5. The debugger stops when it hits the breakpoint in PROG_B.CPP.


NOTE: For information on debugging under these circumstances from within a 32-bit environment, refer to Knowledge Base article Q120707.

Sample Code


   /* Compile options needed: Default QuickWin settings.
   */ 

   // PROG_A.CPP

   #include <iostream.h>
   #include <windows.h>

   void main( void )
   {
      cout << "Starting Prog_a.exe" << endl;
      i = WinExec("prog_b.exe", SW_SHOW);
   }

   // PROG_B.CPP

   #include <iostream.h>

   void main()
   {
      cout << "Greetings from Prog_b." << endl;
   }
 

Additional query words: kbinf 1.00 1.50 CreateProcess


Keywords          : kb16bitonly 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 8, 1999