OutputDebugString() does not work on Windows 7x64
Asked Answered
I

3

8

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!

Imperceptive answered 22/11, 2011 at 22:10 Comment(1)
OutputDebugString works in 7 x64 just fine. DebugView also shows the output of applciations.Bazan
F
13

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.

Frank answered 17/1, 2013 at 9:30 Comment(2)
In my case, I was calling output debug string from an IE-extension. IE in general does not allow such communication. So I ended up running IE as an admin and also running DebugView as an admin.Imperceptive
In my case, I was calling OutputDebugStringW. Changing this to OutputDebugStringA worked correctly.Bellwort
K
12

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.

Kalynkam answered 9/5, 2017 at 14:2 Comment(2)
Thanks so much! I'm not sure how, but I must have accidentally unchecked "Program Output" in the Output pane and was going crazy trying to figure out why I was no longer seeing debug messages. If only I could give you multiple up-votes :-)Ionize
I can upvote both of you instead, so I give up two up-votes already :) Indeed that was long search for me, thank Michael, again.Augmentative
C
4

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.
Constringe answered 22/11, 2011 at 22:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.