Debugging Spawned Applications in Visual C++

Last reviewed: July 22, 1997
Article ID: Q118683
1.00 1.50 WINDOWS kbtool

The information in this article applies to:

  • The Visual Workbench Integrated Debugger included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5

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 reference words: kbinf 1.00 1.50 CreateProcess
KBCategory: kbtool
KBSubcategory: WBDebug
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.