|
-
March 31st, 1999, 12:45 AM
#1
UNICODE question
Hi, I have the following few lines in my program, that get called in OnInitialUpdate() for a RichEditView doc/view app.
CHARFORMAT cfm;
cfm.cbSize = sizeof(cfm);
cfm.dwMask = CFM_FACE | CFM_BOLD;
cfm.dwEffects = CFE_BOLD;
_tcscpy(cfm.szFaceName, _T("Arial" );
theCtrl.SetDefaultCharFormat(cfm);
When compiling with _UNICODE, that code fails on the _tcscpy line, with the following error:
error C2664: 'wcscpy' : cannot convert parameter 1 from 'char [32]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
How can I get this to work with _UNICODE?
thanks,
-Matt
-
March 31st, 1999, 01:50 AM
#2
Re: UNICODE question
In the header file AFXPRIV.H are numerous string conversion macros:
A2BSTR OLE2A T2A W2A
A2COLE OLE2BSTR T2BSTR W2BSTR
A2CT OLE2CA T2CA W2CA
A2CW OLE2CT T2COLE W2COLE
A2OLE OLE2CW T2CW W2CT
A2T OLE2T T2OLE W2OLE
A2W OLE2W T2W W2T
W2A will solve your problem and convert the UNICODE string to normal ASCII
-
March 31st, 1999, 08:50 AM
#3
Re: UNICODE question
Use _UNICODE and UNICODE (without underline)
The following codefragment is from richedit.h:
#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define CHARFORMAT CHARFORMATW
#else
#define CHARFORMAT CHARFORMATA
#endif /* UNICODE */
#else
#define CHARFORMAT CHARFORMATA
#endif /* _RICHEDIT_VER >= 0x0200 */
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
|