Microsoft KB Archive/820993

= You cannot jump to the source file if you press F4 when you are debugging in Visual C++ .NET or in Visual C++ 2005 =

Article ID: 820993

Article Last Modified on 1/4/2006

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-





SYMPTOMS
You can write trace messages to the Output window for debugging purposes. In Visual C++ 6.0, when you press F4, you can jump immediately to the source line that generates the output message. However, if you press F4 in Visual C++ .NET or in Visual C++ 2005, the Property Pages window for the project appears.



CAUSE
In Visual C++ .NET or in Visual C++ 2005, key mappings are changed. The F4 key is mapped to the Open Property window in Visual C++ .NET or in Visual C++ 2005.



RESOLUTION
To resolve this problem, keep the Output window open, and then press F8 to iterate through all debug messages.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior
 Start Visual Studio .NET or Visual Studio 2005. On the File menu, point to New, and then click Project. Click Visual C++ Projects under Project Types, and then click Win32 Project under Templates.

Note In Visual Studio 2005, click Visual C++ under Project Types, and then click Win32 Project under Templates. Accept the default settings, and then click Finish.  In the .cpp file, paste the following code in front of the declaration of the InitInstance function: void Log(LPCTSTR sFile,unsigned int nLine) {   TCHAR str[50]; std::string sMsg=sFile; wvsprintf(str,&quot;(%u): error\n&quot;,(char*)&nLine); sMsg+=str; OutputDebugString(sMsg.c_str); } </li>  Paste the following code after the CreateWindow call in the InitInstance function: Log(__FILE__,__LINE__); </li> Build the project, and then press F5 to run the application in Debug mode.</li> Close the application.</li> Verify that the Output window displays the debug output. The output appears similar to the following:
 * 1) include

< .cpp with full path >(Line Number): error

where  is the name of your .cpp project.</li> Press F4. You may notice that the log line is not displayed.</li></ol>

Additional query words: Hang, Not responding, trace massage, output window, debugging

Keywords: kbdebug kbdevstudio kbprb kbideproject KB820993

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.