TextOut problem

Posted on 2001-07-04
Last Modified: 2013-11-20
GridRect.left, + 18,

I wanna make a TextOut on my screen, but it will only print "Hello#World"

and I can't get the newline to work in the TextOut() function. I want to make use of the \n feature in CString, does I have to use another function to do so, or how can I solve my problem so I can make a print like this

World ?

Question by:win32
LVL 32

Expert Comment

ID: 6252844

for a good tutorial on how to do text.  But the bottom line is that TextOut does not understand the newline (\n) character.  Use DrawText instead as it's a higher-level text output function that has greater capabilities.
LVL 42

Accepted Solution

sedgwick earned 50 total points
ID: 6252952
use DrawText insatead of TextOut:


good luck
LVL 86

Expert Comment

ID: 6253457
You'll have to use "\r\n" to issue a line break, e.g.

GridRect.left, + 18,
LVL 49

Expert Comment

ID: 6253811
One very rarely needs to use TextOut when working with MFC.  

Unless you are writing the low-level guts of a special control, you are much better off creating an Edit Control  or a Static Control and just using SetWindowText().

-- Dan

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 101
Error on moodle after upgrade 3 140
withoutTen challenge 14 133
Annoying "thing" blocks my view 4 117
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question