How to show debug messages from MFC application on command line?

Hi all,

I would like to show some text messages from my MFC application on 
commandline (or better in the Output window in Visual Studio 2005). I tried 
to call
cout << "some text" << endl;
but it doesn't seem to work. What am I doing wrong?

Thanks for any help.
0
Bob4289 (354)
5/18/2007 8:00:01 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
648 Views

Similar Articles

[PageSpeed] 37

>I would like to show some text messages from my MFC application on 
>commandline (or better in the Output window in Visual Studio 2005).

Bob,

For the latter, use OutputDebugString.

Dave
0
davidl7375 (2060)
5/18/2007 8:57:53 AM
>>I would like to show some text messages from my MFC application on 
>>commandline (or better in the Output window in Visual Studio 2005).
> 
> 
> Bob,
> 
> For the latter, use OutputDebugString.
> 
> Dave

Or, for debug-build-only messages,
TRACE(_T("Hello Output Window\n"));

-- 
Scott McPhillips [MVP VC++]

0
Scott
5/18/2007 1:10:58 PM
Well, since stdout does not exist in a WIndows application, it is not at all surprising
that any attempt to use it produces no result.  Also, there is no concept of a "command
line [window]" in a Windows app, so there is no way to write to this.

For MFC, use the TRACE macro to write stuff to the output window.  It works like printf
but it disappears when you compile in release mode.

TRACE(_T("Value is %d\n"), value);

You may also find my Logging Listbox Control useful; you can download it from my MVP Tips
site.
					joe

On Fri, 18 May 2007 01:00:01 -0700, Bob <Bob@discussions.microsoft.com> wrote:

>Hi all,
>
>I would like to show some text messages from my MFC application on 
>commandline (or better in the Output window in Visual Studio 2005). I tried 
>to call
>cout << "some text" << endl;
>but it doesn't seem to work. What am I doing wrong?
>
>Thanks for any help.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
5/18/2007 1:28:20 PM
Reply:

Similar Artilces:

Sending message as a delegate
Is there a way for a secretary to send an email that says it's from two people (she is the delegate for both of these people). jschwartz@pattonboggs.com wrote: > Is there a way for a secretary to send an email that says > it's from two people (she is the delegate for both of > these people). A message can come from only one address/account, so, short answer is no. ...

Error message needed if incorrect Date Of Birth (DOB) entered
Hi, In cell D6 I have a DOB entered....in cell E6 I have a datedif function that has 3 conditional formatting set as: 1 - If D6 is blank, E6 is blank. 2 - If DOB in D6 is between 18 - 24 then E6 shows age and cell is yellow. 3 - If DOB in D6 is 25 or over then E6 shows age and cell is blue. What I need is when a DOB is entered in D6 under 16 years old, then D6 returns an error message -" You have Entered an Age under 16 Years - Retry!! ". I have tried Data Validation, but cant get a message from tha as I dont know what to set as the date validation. I do need a...

Never Ceasing Error Message in My Mailbox
Account: 'cwjamaicA', Server: 'mail.cwjamaica.com', Protocol: POP3, Server Response: '.', Port: 110, Secure(SSL): No, Error Number: 0x800CCC18 Hello, I keep getting the message as stated above in Email box. What does this mean and how can I clear this up. Thanks. Burchie S burchsam@cwjamaica.com ...

ALL of my email is gone- getting error message as well
I am getting this message: The message store has been corrupted by an application external to Windows Mail. Windows Mail has been able to successfully recover from this corruption. (0x0000000) In addition ALL of my emails are gone. Any suggestions on how I can recover them? And what I should do about the message. Try running the various repair functions in the WMUtil program: http://www.oehelp.com/WMUtil If still no improvement, upgrade to Windows Live Mail: http://download.live.com/wlmail It will automatically import all your WM data. Gary VanderMolen, Microsoft MVP (Mai...

Where Can I Find The Icon For A New E-mail Message In Outlook?
I've created the shortcut "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE" /c ipm.note for my Outlook to open a new message but it assigns the Outlook Icon... Thanks Assuming you are using an English version Outlook 2003, you might find what you are looking for at: \Program Files\Microsoft Office\OFFICE11\FORMS\1033 "Justern" <justern@hotmail.com> wrote in message news:4133cc19$0$27218$61ce578d@news.syd.swiftdsl.com.au... > I've created the shortcut "C:\Program Files\Microsoft > Office\OFFICE11\OUTLOOK.EXE" /c ipm.note for m...

How to filter to show only one message from a specific sender/subject
I would like to filter out all but one email with the same subject line from a specific sender. I subscribe to a message board that sends an email every time a posting is made to a thread, instead of just the first posting after I have read the thread. Is there a way for filter out the duplicate messages and just keep the oldest email? Thanks, Brian ...

how to edit my x-axis data on a line graph
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel my x axis data on my graph is just showing numbers 1 2 3 4 5 6 7 8 9 10 11.... and it is suppose to show the years. I can't figure out how to change these values ...

show tasks on the calendar
I would like to see tasks on the calendar in both weekly and monthly view -it gives you a sense of those "things to do" items that are coming up. I tried it with due dates and start dates, clicked "show tasks without due dates", clicked show all tasks, consulted Help and my copy of Outlook for dummies. It seems so basic but I HAVN'T BEEN ABLE TO GET IT TO DO IT!!! Related question -why is it that Microsoft software NEVER behaves as you would reasonably expect? -e.g we all write "to do" type items in our paper diarys for certain days -without a fixed time...

Losing the Document in a SDI application
I have a fairly complicated SDI application which recently has had the problem that it, at times, looses the document. Basic architecture is SDI, with a splitter window. The Document has three views: View1 is always present in Pane(0,0) of the splitter. View2 and View3 are presented in Pane(0,1) of the splitter, with the Mainframe handling the switching between the two. The application has a serial connection to a piece of lab equipment. We have a threaded serial communication class, which posts a message when data is received. When the RECEIVED message is posted, the Mainframe rea...

How do I get deleted items that stay in inbox with line thru them.
I inherited a computer at work. Outlook is setup so that when I delete a message it stays in the inbox, with a line thru it. How do I get the deleted items to go automatically to the deleted item folder? "rwwhit" <rwwhit@discussions.microsoft.com> wrote in message news:7D17761E-CD1B-4D04-BACB-B0D837C4DD93@microsoft.com... >I inherited a computer at work. Outlook is setup so that when I delete a > message it stays in the inbox, with a line thru it. How do I get the deleted > items to go automatically to the deleted item folder? That's normal behavior...

Send and Receive All Error Message
When Sending and Receiving before going offline with Outlook XP,(exchange 2000) I get the following error... Task 'Microsoft Exchange Server' reported error (0x8004010F) : 'The operation failed. An object could not be found. ...

Preventing Recipient Names from Showing
I have a long list of people I am addressing a message to. I want the recipient to see that it is coming to them, but not be able to see anyone else's name/address that it's being sent to. I've tried the BCC field but then even the recipient does not see that it was sent to them. I'm afraid they will think it is junk mail if they don't see it addresses to themselves. Check out http://www.slipstick.com/addins/mail.htm#massmail for other options -- PATRICK REED [Outlook - MVP]~~~~~~ -Microsoft Certified Professional (MCP) -Have you checked http://www.slipstick...

Using a VBscript to copy/delete/move Outlook messages
I need to write a VBscript to: - open my Outlook (2000 or XP) mailbox - read the list of the folders in either the Exchange Mailbox and in local ..pst files - open each folder and subfolders - read information about messages (i.e. sender, recipient, creation date, and so on) - move, copy or delete messages based on the above information Can anybody please provide a pointer to a sample I can start from? Regards Marius ...

Multi-language MFC app: how to?
Hi, I'm looking for a good way to 'translate' my MFC app to multiple language. I'd like to use a single binary and if possible allow switching languages and maybe even changing strings while the app is running. Are there any how-tos for this? Olaf van der Spek wrote: > Hi, > > I'm looking for a good way to 'translate' my MFC app to multiple language. > I'd like to use a single binary and if possible allow switching > languages and maybe even changing strings while the app is running. > > Are there any how-tos for this? I am also star...

VBA- Application.Wait?
Does PowerPoint not have "Application.Wait" like Excel? Is there another way to pause code for a few seconds in PPT 2003/2007 while a small bat file runs? -Mel On 3/10/10 2:29 AM, Mel wrote: > Does PowerPoint not have "Application.Wait" like Excel? Is there > another way to pause code for a few seconds in PPT 2003/2007 while a > small bat file runs? > > -Mel From Example 8.4 on my Web site (http://www.PowerfulPowerPoint.com/): Sub Wait() waitTime = 5 Start = Timer While Timer < Start + waitTime DoEvents ...

MFC Dialog
Question One Why when I add a menu, the dialog size cuts off the bottom so that only half of the buttons (Ok & Cancel) show? I guess when the toolbar is added across the top, the dialog does not compensate. Question Two When adding a menu Help->About, is there a way to invoke the system menu that is already hidden in the upper left corner icon? You can mouse over the icon and get this menu to display. Just wondering if I should access that code instead of my own: CAboutDlg dlgAbout; dlgAbout.DoModal(); Thanks Added Information: This is the only code I'...

Restore messages from Exchange database
Our SBS2000 crashed the other day without a backup of Active Directory. We now only have a backup of the exchange database (edb and stm files). The domain has been recreated from fresh and 5 computers were re-joined the domain. Exchange also were installed. Question: what would be the right way to restore the messages from the edb and stm backup copy? Thank you in advance! -jesk Jesk You'll have to recreate the Exchange org and do a restore. http://www.microsoft.com/technet/prodtechnol/exchange/2003/library/disrecopgde.mspx Unless you have a flat file recovery tool like Quest R...

View both incoming/outgoing messages by Thread or Conversation ? #2
Is it possible to view messages in outlook 2003 by Thread or Conversation, both incoming and outgoing, in a single folder, or Inbox, just like Outlook Express News Reader. For example: + Sent Message + Received Reply +Sent Message or Replied + Received Reply I tried using Arrange by Conversation Option in outlook 2003 Inbox Folder, but its just showing Inbox Messages, not Sent Items Messages. Best Regards, Luqman ...

Force command to run for each computer in txt file list of compute
I have a few hundred computers that haven't been defragged in years. I was wondering if rather than doing it manually, if someone had a script where if i just put all the computer names in a txt file, it would iterate through the list and perform a "defrag c: -f" on them all from my workstation. The workstations all have the same local administrator password, so the process would be the same for each. I just dont know how to write scripts. I know if i were going to do this manually from my computer I would run the command below for each ComputerName psexec ...

Carriage Return/Line Feed Problem
Hi guys, I wrote some code that gets the HTML from a Web page and stores it in a buffer, then I display the buffer in a big multiline CEdit box. The problem is that on many pages I don't get new lines, I just get a thick solid verticle line kinda like this: || where it should return. Also, if I view the pages (view source) in Notepad they look fine. Most pages do that, but interestingly Microsoft pages do the proper new line and look great in my edit box. Maybe I have to replace all the \r with \r\n or something like that ? Does a \r\n still only take up 1 char ? I download the page in...

Add a horizontal line to a graph but not to the legend
I want to be able to add horizontal lines to my chart, in this case at 4% and 6% on the y-axis. The solutions I've seen so far suggest to add a series at these points. The problem is that when I add a seires, my legend shows the new series when I don't really want them to. Is there a really simple way that I've overlooked so that I can just add a line at one y-value and all the x values on the graph and not have it appearing in the legend? Thanks I have just tested inserting an extra series in both xl2002 and xl2007 and if you select the legend and then select the indiv...

How to get rid of a "line" in Word
If I type a number of dashes in Word and press Return it automatically gets changed into a continuous line. How do I later remove such a line? Sometimes if I delete the text line above it then the line also goes but often I just can't get rid of it. I have to resort to creating a new document and then copy/paste the god bits over and then delete the old document. Thanks. -- Les Desser (The Reply-to address IS valid) In news:lzqSlgmVscxLFAoG@dessergr0up.invalid, Les Desser <NewsDump1@dessergroup.com> typed: > If I type a number of dashes in Word and press ...

Send button not showing after updating to SP3
I have updated the office 2002's .msi file with SP3 for network distribution. After redeploying the updated file I few users do not have a send button when the try to send a message. I have tried to delete their accounts and set them up form scratch with no luck. My only work around was to install office from CD. I need to resolve this problem. The installation from the network is a great tool. Thanks DG ...

MFC & peer-to-peer & DHCP
hi everybody! herez the thing: i'm working on an instant messenger based on the great NDK set of classes (Network Development Kit - you can check it out at www.codeproject.com). things are doing great, except for one thing.. my intended audience lives in croatia (www.hr) and everyone here has DHCP, and i mean heavy DHCP - if you reconnect in a matter of seconds, you get a new IP! so, how am i supposed to create a p2p app, if my users are changing their IPs every day? i don't have any servers available for maintaining user list online, it has to be "strictly" peer-to-peer, ...

Problem sending image from ASP to C++ application
I am having a problem returning an image that I got from SQL Server from within an ASP page that got requested from a VC++ application. Specifically, within my application, I make an HTTP call to my IIS server to an ASP. The ASP then queries a SQL Server and the field that I want to return from the resulting Recordset is an image. In the application, I then make a call to receive the response from the web page but am having no luck getting anything back. I have included both the ASP page and the code from wthin the VC++ application. The part in the C++ code that I am debuggin and noticing ...