|
#1
|
|||
|
|||
Console output from Win32 app
Is it possible to output text strings from a C Win32 application that will be captured by VBP?
Basically we have a utility that supports a command line mode to suppress any message boxes and other UI, but I'd like to be able to send any error strings back to the VisualBuild Pro log. I can do this from a Visual Basic app with ConsoleWrite(), but this other utility is in C and I can't find an equivalent. Using AttachConsole() and writing to that sort of works from an command prompt (the output is not very tidy, but good enough), but this is not captured by VBP. |
#2
|
|||
|
|||
printf works in my tests. In VC 7.1 (VS.NET 2003), I created a new Win32 Project, added #include <stdio.h> at the top and a printf statement in _tWinMain, built it, then ran it from VBP (with Run Program step marked to not hide the app window). After closing the program's window, the printf output was captured and logged by VBP.
|
#3
|
|||
|
|||
Hmmm... doesn't seem to work from VC6 - that's what I had originally before delving into the depths of AttachConsole().
In the end I have added a new build target that produces a proper command line app - just added an old style main() in addition to the winmain() and I can use all the same code, just from a different start point. Thanks for the help anyway. |
#4
|
|||
|
|||
You're quite right - it does work from more modern Visual Studio versions (just tried VS2005) - how irritating!
Still, my "proper command line" version is better I suppose, since it will output results to the console when run run from an command prompt, which just upgrading to a newer compiler doesn't. Thanks again! |
Thread Tools | |
Display Modes | Rate This Thread |
|
|