I'm new to programing, period.
I'm working with the default Microsoft MFC Application template in Visual Studio 2008.
Using pDC->TextOutW, I'm trying to get a variable (an int or a double) in place of the LPCTSTR.
void CFibbiMFCView::OnDraw(CDC* pDC)
{
CFibbiMFCDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: add draw code for native data here
double x = 1;
pDC->TextOutW(10,10,x);
}
This (obviously to likely all of you) doesn't work. Is there a way to change the integer to what TextOutW wants? Or should I be going about this a whole other way?
TextOutW and Variables
Started by intrinsik4, Dec 16 2009 02:13 AM
1 reply to this topic
#1
Posted 16 December 2009 - 02:13 AM
|
|
|
#2
Posted 16 December 2009 - 06:29 PM
You need to convert your integer into a Unicode string first. I would look into using an ostringstream.
#include <sstream> #include <string> using std::ostringstream; using std::string; ostringstream mystream; string newstring; int x = -5; mystream << x; newstring = mystream.str(); //newstring now contains "-5".
sudo rm -rf /


Sign In
Create Account

Back to top









