How do you display text within a window using the MS Foundation Classes?
Printable View
How do you display text within a window using the MS Foundation Classes?
Try using something like:
pDC->TextOut(0,0,"Hello Wrold");
first you have to get permission from the O/S to output to the screen, so, do this:
after that, you have your pointer, and youve called OnDraw...to output anything you have to go thru OnDraw....anyways, after that, you can directly output from OnDraw, or you can call another class's function and output from there..to do that, just send the pDC pointer to it...ya, so then, just doCode:CDC* pDC;
pDC = GetDC();
InvalidateRect (0);
OnDraw(pDC);
the first 2 parameteres are the start x and y pixels on the screen...0, 0 would be the top corner, and so on.....the 3rd MUST be a string...if your trying to output numbers, you have to first convert it to a string, then output itCode:pDC -> TextOut (x, y, "Hello");