Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-28-2008, 06:35 AM
DuncanL DuncanL is offline
Registered User
 
Join Date: 07-26-2007
Posts: 29
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.
Reply With Quote
  #2  
Old 02-28-2008, 10:53 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #3  
Old 02-28-2008, 11:03 AM
DuncanL DuncanL is offline
Registered User
 
Join Date: 07-26-2007
Posts: 29
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.
Reply With Quote
  #4  
Old 02-28-2008, 11:09 AM
DuncanL DuncanL is offline
Registered User
 
Join Date: 07-26-2007
Posts: 29
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!
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 06:05 PM.


Copyright © 1999-2023 Kinook Software, Inc.