whats the equivilance of:
cout << "the screen size is: " << x;
or
printf("the screen size is: %d", x);
in winapi
is there a way to print the ints like that in winapi?
i can't find a way to do that with textout or drawtext.
was wonder how to print a string with a int variable in WinAPIcan't make it work with drawtext or textout :(
Page 1 of 1
6 Replies - 1113 Views - Last Post: 04 November 2008 - 01:22 PM
#1
was wonder how to print a string with a int variable in WinAPI
Posted 03 November 2008 - 10:06 AM
Replies To: was wonder how to print a string with a int variable in WinAPI
#2
Re: was wonder how to print a string with a int variable in WinAPI
Posted 03 November 2008 - 04:57 PM
http://msdn.microsof...019(VS.85).aspx
From the looks of it, you should be able to put an integer value in the string itself and have TextOut just output it all.
From the looks of it, you should be able to put an integer value in the string itself and have TextOut just output it all.
#3
Re: was wonder how to print a string with a int variable in WinAPI
Posted 03 November 2008 - 07:42 PM
after reading a few chapters in Charles Petzold Book
i found:
and thanks Hyper, i didn't understand how wsprintf works at first but your explanation of wsprintf helped me understand it
i found:
int iA =12, iB = 7; int iLength; TCHAR szBuffer[40]; iLength = wsprintf(szBuffer, "The sum of %i and %i is %i", iA, iB, iA + iB); TextOut(hdc,x, y, szBuffer, iLength);
and thanks Hyper, i didn't understand how wsprintf works at first but your explanation of wsprintf helped me understand it
This post has been edited by Pat234: 03 November 2008 - 07:43 PM
#4
Re: was wonder how to print a string with a int variable in WinAPI
Posted 03 November 2008 - 07:54 PM
You're welcome, very much!
Thank you for using the "Thanks this post helped!" button.
Charles Petzold Book? The "Programming Windows 5th Edition?"
Thank you for using the "Thanks this post helped!" button.
Charles Petzold Book? The "Programming Windows 5th Edition?"
#5
Re: was wonder how to print a string with a int variable in WinAPI
Posted 03 November 2008 - 08:39 PM
Hyper, on 3 Nov, 2008 - 06:54 PM, said:
Charles Petzold Book? The "Programming Windows 5th Edition?"
Yeah, that same exact book. Glad i bought it with its 1,500 pages worth of info lol
(link: http://www.amazon.co...5...F8&s=books)
#6
Re: was wonder how to print a string with a int variable in WinAPI
Posted 04 November 2008 - 07:31 AM
is there any more WinAPI to print like this..??
#7
Re: was wonder how to print a string with a int variable in WinAPI
Posted 04 November 2008 - 01:22 PM
codesrock, on 4 Nov, 2008 - 06:31 AM, said:
is there any more WinAPI to print like this..??
Yes, there is:
- TextOut: http://msdn.microsof...019(VS.85).aspx
and
- DrawText: http://msdn.microsof...909(VS.85).aspx
Welcome, hope it helps.
EDIT: I'm glad that *exact book* has helped you, Pat234, that's quite good to know.
This post has been edited by Hyper: 04 November 2008 - 01:23 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|