OutputDebugString() does not work on Windows 7x64

16.4k Views Asked by At

My program works great with windows xp. I am trying to add some more functionality and using OutputDebugString() to show some debug information. works flawlessly on XP. Now when i want to use the same program on windows 7x64. I dont see any output in DebugView.

F1! F1! F1!

3

There are 3 best solutions below

2
On BEST ANSWER

Sorry for reviving an old question, but we spent a good couple of days searching the internet to answer this one and eventually ended up logging a connect call. I am posting here to help anyone else in the same situation. Our specific problem was getting the output from OutputDebugString, MFC TRACE etc in the debug output window when debugging an x64, mixed mode application.

According to Microsoft, apparently for debugging x64 mixed mode applications the debugger type of 'auto' (set in the Debugging->Debugger Type property page) defaults to managed rather than mixed. This will need to be explicitly set to 'Mixed' for both managed and native debug output to be seen when debugging a 64 bit build.

0
On

3 small suggestions:

  1. make sure you are actually capturing events (top menu -> capture -> capture win32 is marked)
  2. if you program is running in low integrity (does it give a security warning when you are running it) you need to run debug view in low integrity as well. to do that you need to change the integrity level of dbgview.exe before running it.
  3. if you are using visual studio and running with debugger (pressed F5) then the debug output is actually captured by visual studio (in the output window). try running your program with ctrl f5.
2
On

There are a number of reasons why this may or may not work. I accidentally disabled this -- here are all the things you need to check to get this working:

  1. Is the debug output text getting redirected from the Output pane to the Immediate pane, thus you are not seeing it? To turn this off:

    • Debug
    • Options and Settings
    • [ ] Redirect all Output Windows text to the Immediate Window
  2. Is the Output pane visible?

    • Debug
    • Windows
    • Output
  3. In the Output pane do you have Program Output enabled?

    • Debug
    • Windows
    • Output
    • Right-Click anywhere inside the pane
    • [x] Program Output
  4. Do you have the right Debugging Type selected?

    • In the Solution Explorer (View > Solution Explorer) pane
    • Right-click on your project
    • Properties
    • Debugging
    • Debugging Type: change from Auto to either Native or Mixed
  5. Is the debugger tried to get attached before the program has started? To turn Attach off:

    • In the Solution Explorer (View > Solution Explorer) pane
    • Right-click on your project,
    • Properties
    • Debugging
    • Attach: change to No
  6. Are you using OutputDebugStringW()? Try using OutputDebugStringA() instead.

  7. Lastly, did you start the program in debugging mode? :-) Hey, you never know!

    • Debug
    • Start Debugging (F5)

I hadn't seen a comprehensive list before so the above are all the things I had to verify were set correctly.