|
-
April 21st, 1999, 11:58 AM
#1
help with CString
I copied code which creates a masked edit control. To return the time in a string rather than a COleDateTime object, the author says to use
CString string = m_editCtrl.GetTimeStr();
When I then try the following code,
CClientDC cDC(this);
cDC.TextOut(10,10, string);
my program crashes at TextOut statement. What am I doing wrong? How can I convert this CString into just a char string that I can then print?
Any response any one can give me will be greatly appreciated.
-
April 21st, 1999, 01:00 PM
#2
Re: help with CString
Not sure why your code isn't working. You may want to try using MessageBox(string) to take a look at the string before you use TextOut(). To convert a CString to a char string, I do the following:
char buff[80];
sprintf(buff,string);
Hope this helps. Best of luck.
- Mark Robison
-
April 21st, 1999, 01:05 PM
#3
Re: help with CString
What is the nature of the crash? Do you get an error message?
The m_editCtrl seems like something that would be on a dialog. CDC::TextOut()
is something you would ordinarily use in a user draw window. Normally you
would not be making a CClientDC using "this" from a dialog, but from the window
you are actually going to draw in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|