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
595 Views

Similar Articles

[PageSpeed] 15

>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 (15974)
5/18/2007 1:28:20 PM
Reply:

Similar Artilces:

How do I add vertical lines to separate columns in Outlook 2003 #2
In Outlook 2000, all columns were separated by a gray vertical line. I can't seem to set this up in Outlook 2003. Any help would be appreciated ARe you using Word as the message editor? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, mschwartz asked: | In Outlook 2000, all columns were separated by a gray | vertical line. I can't seem to set this up in O...

Linking message
Hi, I've a database that's linked to the Inbox of my Outlook,Is there a way to create a button that once i click on it opens the message itself from the Outlook? Regards ...

Re: how to make a stealth application
"Joseph M. Newcomer" wrote in message " Note that I cannot install software on my email machine when logged in as 'email'. I have to log off, log in as admin, install the software, and then log back in as 'email'. Worth pointing out that some children who build antispam software only allow the software to run for the installing userid, not have it installed system-wide by a sysadmin. A waste of money." Sir, I am 100% agree with you in above case, but i am just puting my point here, Please i am very-2 grateful if you point out anything that i have ...

CDOLive Automatic Message Responding Script
This appears to be a great way to have an autoresponder without having a client-side Outlook rule running all the time, http://www.cdolive.com/autoreply.htm I've tested this solution with good results, however i'm concerend about routing loops. It's setup to ignore NDR's, out-of-office autoreplies, meeting requests, etc., but it will still respond to, say, another autoresponder. I'd be more comfortable if it only reposnded to a specific address once during a given period, like Outlook rules. Is there a better way to do this? I want something that can run server-side o...

Passing an argument from a query to a command
I am trying to send a report using an email address in a DB. I wrote the following code for it. Private Sub Reminder_Letter_Command_Click() On Error GoTo Err_Reminder_Letter_Command_Click Dim stDocName As String Dim SendTO As String stDocName = "BG Reminder Letter" RunQuery MsgBox "This is After RunQuery " & SendTO SendTO = [Queries]![BG email only from email from ae code].EmailAddress MsgBox "This is SendTO 2 Value ==== " & SendTO DoCmd.OpenReport stDocName, acViewNormal DoCmd.SendObject acSend...

error message 01-01-10
Unable to send or receive messages for the Hotmail (**********) account. To send and receive messages in your Hotmail account, go to http://hotmail.live.com on the Web, or try again later. To get help from Windows Live Customer Support, go to http://support.live.com and click Windows Live Mail in the list of services. Subject 'Greetings' Windows Live Mail Error ID: 0x80070057 I want to know how to dump this popup. I don't need to send the message and everytime I open windows live mail, this error message regarding an unable to compete task shows up. How do I ge...

Purchase Order Entry Error Message
While in version 8.0g34 and Purchase Order Entry window opened. User accidentally minimized the window instead of closing the window. User closed window while minimized and the following message appeared. Unhandled script exception Object has no reference EXCEPTION_CLASS_SCRIPT_BAD_PARAM OK User clicks ok approx. 10 times and the window finally closes. Why does this happen? Perhaps a fix should be applied. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree...

OLE: Excel.Application
Hello, in VB.Net, I use Excel to display results : dim xl as new Excel.Application // creates an Excel process // snip (putting values into cells) xl.Visible = true If the user closes the Excel file and then my program, the Excel process is killed in memory, which is good. If the user closes my program first and then the Excel file, the Excel process remains in memory ! How can I make sure the process will be killed ? Thanks ! Hi You need to set xl.quit (and before that ensure that excel doesn't halt and ask things like "save changes?" on quitting) somewhere in your p...

Rich edit control and having a hypertext control to send the messages to windows
Hi Here is the code to detect that if a click is made on word "START". But I have many "START" word Is there any way to detect which "START" word has been clicked? Please Let me know if any Thanks Anup void CRichEditGSDlg::OnLinkRicheditStatic(NMHDR* pNMHDR, LRESULT* pResult) { ENLINK *pLink = reinterpret_cast<ENLINK *>(pNMHDR); FINDTEXTEX findText; *pResult = 0; if( pLink->msg == WM_LBUTTONDOWN ) { long lStart = pLink->chrg.cpMin; long lEnde = pLink->chrg.cpMin; m_Ctrl_RichEditStatic.SetSel(pLink->chrg); CString strLi...

problems with toolbar-can't access certan commands i.e.hyperlink
can't access some commands - was working fine - now some commands are in grey - the commands disappeared from the pull down in the commands bar. Help magnus wrote: > can't access some commands - was working fine - now some commands are in grey > - the commands disappeared from the pull down in the commands bar. The hyperlink option may only appear when you are creating a Web Publication in certain versions of Publisher. -- Ed Bennett - MVP Microsoft Publisher http://ed.mvps.org Trial version? You may have run out of time. Some pulldowns only work when you are creating a ...

How do i locate the point of intersection of two lines graphs
I have a plot of two lines using excell which intersect at a point. I want to locate the point of their intersection using excell and show the co-ordinates of that point so that any body can see that i read that point from it. Step by step procedurewould be helpful and i am using microsoft excel 2007. Thanks. I will assume you have two straight lines - if not please tell me what they are. Let the lines follow the two functions y1=m1x1+b1 and y2=m2x2+b2 Let the point of intersection be Y and X Then m1X+b1=m2X+b2, giving X=(b2-b1)/(m1-m2) In Excel terms, X=(INTERCEPT(y-values2,x-values2)...

Undeliverable email message..._
My ISP migrated to a new smtp server and I had to make the necessary changes to relay my messages correctly. However, when I forward an e-mail or reply to a cashed mail address I receive the following: From: System Administrator Sent: Monday, October 04, 2004 4:26 PM To: email@domain.com Subject: Undeliverable:RE: Message Your message did not reach some or all of the intended recipients. Subject: RE: Message Sent: 10/4/2004 4:26 PM The following recipient(s) could not be reached: email@domain.com on 10/4/2004 4:26 PM You do ...

How to paste animation in publisher for an email message
In a MS Publisher document, I have pasted animated bmp & gif files. When I send the doc by MS Outlook email, the animation doesn't work when the message is pulled up. Is there a special way to paste & activate animation in Publisher? This is not an option in Publisher. Publisher automatically changes the animated images to normal images. -- Brian Kvalheim Microsoft Publisher MVP http://www.publishermvps.com This posting is provided "AS IS" with no warranties, and confers no rights. "Flyboy" <Flyboy@discussions.microsoft.com> wrote in message news:...

How to print Directly from Dialog based application
HI all, I am writing MFC Extension DLl which has dialog in it. It has list of documents ( like .doc,.xls,.pdf etc....) When user double clicks the document I do ShellExecute to open it..... Now i have print button . When user clicks Print button Selected document in the list should be printed...... I want to print that document directly ( that is without opening corresponding application....e.g. want to print 1.doc without opening MSWord) How can i achive this? Will DDE command will help ? How? Any Guidence Or Link for that? I have tried with ShellexecuteEx with "print" as verb ...

excel 2000 message
excel 2000 message - 'cannot use object linking and embedding' Were they hit by the MSBlast worm? One poster (Lutz Meyer) guessed that this was the cause of his problems. I haven't seen any confirmation/denial, but you may want to read his post: http://groups.google.com/groups?threadm=3F3971AF.FA4490F5%40msn.com Post back with your results. I'm curious if that was the problem. (It's come up quite a few times since MSBlast hit.) bill bootle wrote: > > excel 2000 message - 'cannot use object linking and > embedding' -- Dave Peterson ec35720@msn.c...

Finding the last line on a spreadsheet
If hitting the Ctrl - Home buttons will find the first entry on a spreadsheet, what is the quickest way to find the last line. does anyone know of a website with these types of shortcuts. Ctrl-End will send you to the last line. in the Excel Help, select "Hotkey" and you'll get a list of all the different keyboard shortcuts. "derwood" <darren.irvine@gmail.com> wrote in message news:1131173033.742797.236360@g49g2000cwa.googlegroups.com... > If hitting the Ctrl - Home buttons will find the first entry on a > spreadsheet, what is the quickest way to find ...

A question about threads and message queues.
I'm writing a program using MFC, actually I've done this technique several times. I have a primary UI in one window, and I make a UI thread that has a different window that is displaying some graphics. I have a commercial graphics library that has 'transitions' (ways to go from one image to another using wipes or fades and the like). These transitions can be run in a loop for high speed, but still take a few seconds, during which time the UI on all threads in the app freeze. The solution to this is to repeatedly send a message to do the next step (via a timer or otherwise) ...

Excel Graphing Line References off when chart is a sheet.
I have noticed that when any graph is created in EXCEL and you hover you mouse over the dataline you receive that corect response. If you convert the chart to a sheet, the hover of the data line is now not representative of the the y axis directly below it. The data being graphed is correct now the hover represents the "series" (x-Axis) correctly but does not represent the "Point" (y-axis) correctly at all. Tne Y-axis datapoint reference is wrong. Any help? ...

Default recipient for new messages?
Is it possible to have Outlook XP load a default recipient for new messages? yak <bruce_henke@hotmail.com> wrote: > Is it possible to have Outlook XP load a default recipient for new > messages? Do you mean that you want a particular person to receive a copy of all the mail you send? There's a rule that will do that. -- Brian Tillman Brian Tillman wrote: > yak <bruce_henke@hotmail.com> wrote: > >> Is it possible to have Outlook XP load a default recipient for new >> messages? > > > Do you mean that you want a particular person to rec...

error message when trying to install WMP 10 or 11
My operating system is Windows XP Home Edition 2002. I'm trying to download either WMP 10 or 11 and I get a message saying it was not possible to complete setup, see webhelp for more assistance, however there is no additional information when I click Web help. the Error message is 8007F0DA. Can anyone help me? Thanks. On Tue, 30 Mar 2010 07:54:01 -0700, Nate <Nate@discussions.microsoft.com> wrote: > >My operating system is Windows XP Home Edition 2002. I'm trying to download >either WMP 10 or 11 and I get a message saying it was not possible to &g...

MFC (VS2008SP1) app deploying
Hi I've created app using MFC in VS 2008 SP1, when tested on other machines I've got error(s), all point to missing dll's. Did try to statically link but that provided more errors on compiling my project, so I've decided to build msi setup deployment. My first issue is weather to use merge modules or redistribute re-dist packets (which I would download from MS). Then (if I would go for later solution) I would need to resolved next few steps: - check if target PC already have vs2008 sp1 re-dist files installed - if not, check for platform version 32 or 64 and then - in...

duplicate pop3 messages everytime restarting outlook 2003
Everytime I close and then reopen Outlook 2003, it keeps on downloading the same messages off my POP3 servers, which means I have to go and delete them again and again. I need to keep messages on my server because I sometimes need to access those messages from a remote location via webmail. The Microsoft Outloook support simply acknowledged the problem, but how do I stop it?! There was no such problem with Outlook Express... How many accounts do you have? Could you turn on diagnostic logging (see http://support.microsoft.com/default.aspx?scid=kb;en-us;Q300479) and post the OPMLog.l...

possable to show OL only in systray
Hi all, I can have outlook 2003 constantly running but would just like to move it to the systray rather than on the task bar, so i can continue to receive the popups informing me of new mail thanks michael Sure, rightclick the icon in the Notification Area and select Hide When Minimized -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Michael" <trott@bigpond.net.au> wrote in message news:MBHYc.13545$D7.3183@news-server.bigpond.net.au... &g...

error message C00D11B1,original code 80004005
Running WMP 11, Windows Vista Service Pak 2 Home Premium,32 bit operating system, DVD rw file system udf 2.01 and driver version 6.0.6002.18005. All I am trying to do is burn my digital camera videos that I put in WMP 11 to a cd-r . Something is set wrong somewhere because my videos are MOV. and I have to do the right click and Open With classic media player to see them. I have the support info.but it is a bit lengthy to copy to this post.It does have the codecs decoders ect. Don't see MOV. on the list. I have Quick Time also. Thanks for any help! -- Deb I'm pret...

Receiving messages in outlook #2
Hi This is probably embarrassing easy to solve but I cant do it and it has stopped me using outlook until I can this problem solved - :) When I receive emails into outlook - if the email is formatted - the format is lost. If the email has a picture - instead of showing the picture it shows the address of where the jpg or gif file address. Its making emails extremely hard to read and I cant figure out what I must of ticked/unticked to get them like this as i have checked the options and cant do it. Anybody help me with this? Ta Mike some junk mail received that shows my problem : <...