Click here to Skip to main content
15,905,616 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionCan't stop the ATL Service in windows 2003 Pin
sumathi pandarinathan3-Jun-07 17:08
sumathi pandarinathan3-Jun-07 17:08 
QuestionTwo Custom Context Menu Extensions are Now Mutually Exclusive (Vista) Pin
Jeffrey Walton3-Jun-07 16:58
Jeffrey Walton3-Jun-07 16:58 
AnswerRe: Two Custom Context Menu Extensions are Now Mutually Exclusive (Vista) Pin
Jeffrey Walton4-Jun-07 14:32
Jeffrey Walton4-Jun-07 14:32 
Questionproblem with adding toolbar using shared addin? Pin
Banks K31-May-07 1:37
Banks K31-May-07 1:37 
QuestionOLE DB Pin
User 1278230-May-07 18:59
User 1278230-May-07 18:59 
QuestionCreate an ActiveX control through code Pin
arjunmarwaha29-May-07 18:35
arjunmarwaha29-May-07 18:35 
AnswerRe: Create an ActiveX control through code Pin
Clebson Derivan31-May-07 4:17
Clebson Derivan31-May-07 4:17 
QuestionHow to represent correctly UTF8 strings in WTL controls? Pin
Vlad029-May-07 7:01
Vlad029-May-07 7:01 
I wrote a prog that parses files in certain format,
extracting some UTF8 strings (language may be
arbitrary) out of these files
and placing these strings in Window.Forms controls
like RichEdit and ListBox. This program was written
originally in C#.NET, and the strings were correctly
drawn in the corresponding controls via using
GetString() method of System.Text.Encoding.UTF8.

Now I'm translating the prog from .NET to WTL.
The problem is that I failed to make WTL controls
(derived from CListViewCtrl and CRichEditCtrl templates)
to correctly interpret extracted multibyte UTF8 strings.
The compiler settings for the project are default:
"Use multibyte characters" (_MBCS).
Besides, I set explicitly code page to CP_UTF8 writing
"_setmbcp(CP_UTF8);" in the .OnCreate() handler in MainFrame.cpp.
However it produces no effect: instead of, say, cyrillic strings
of size N there is drawn an abracadabra
of size 2N, i.e. the corresponding controls interpret the string as
the sequence of ordinary bytes instead of the sequence of UTF8 characters
2 bytes wide each.

The attempt to convert UTF8 strings to Unicode with MultiByteToWideChar()
failed as well. Though the resulting strings are correct unicode strings,
substituting them into controls (with LPCTSTR cast -- otherwise source
failed to compile) leads to drawing the first char only for ordinary ASCII
symbols and to drawing an abracadabra (of different kind than that without
unicode conversion). If one substitutes in the controls
CString(UnicodeString) instead of pure Unicode string, then ASCII
strins are represented correctly, but in place of cyrillics stand
a sequence of "?" (of correct length N).

So the question is: do there exists a way to compile the project
with _MBCS option (instead of _UNICODE -- which produces a big number of
error messages all over the code and I would not like to rewrite the whole
code) and to draw, nevertheless, the strings correctly inside WTL controls?


AnswerRe: How to represent correctly UTF8 strings in WTL controls? Pin
Michael Dunn29-May-07 9:04
sitebuilderMichael Dunn29-May-07 9:04 
GeneralRe: How to represent correctly UTF8 strings in WTL controls? Pin
Vlad030-May-07 4:09
Vlad030-May-07 4:09 
QuestionHow can i use a ATL Simple Object as word addin? Pin
Banks K28-May-07 21:28
Banks K28-May-07 21:28 
QuestionBHO event about IE focus Pin
dynfrompoly24-May-07 11:21
dynfrompoly24-May-07 11:21 
QuestionCOM applications. Pin
tom groezer24-May-07 9:19
tom groezer24-May-07 9:19 
AnswerRe: COM applications. Pin
Michael Dunn24-May-07 13:46
sitebuilderMichael Dunn24-May-07 13:46 
QuestionCode Pin
tom groezer24-May-07 9:15
tom groezer24-May-07 9:15 
AnswerRe: Code [modified] Pin
Stuart Dootson24-May-07 10:47
professionalStuart Dootson24-May-07 10:47 
AnswerRe: Code Pin
Michael Dunn24-May-07 13:47
sitebuilderMichael Dunn24-May-07 13:47 
QuestionATL dialog Pin
tom groezer24-May-07 9:11
tom groezer24-May-07 9:11 
AnswerRe: ATL dialog Pin
Michael Dunn24-May-07 13:48
sitebuilderMichael Dunn24-May-07 13:48 
QuestionDownload progressbar implementation Pin
Arif Siddiquee22-May-07 8:37
Arif Siddiquee22-May-07 8:37 
AnswerRe: Download progressbar implementation Pin
Hamid_RT22-May-07 8:48
Hamid_RT22-May-07 8:48 
GeneralRe: Download progressbar implementation Pin
Arif Siddiquee22-May-07 8:54
Arif Siddiquee22-May-07 8:54 
GeneralRe: Download progressbar implementation Pin
Hamid_RT22-May-07 9:05
Hamid_RT22-May-07 9:05 
Questionplace FlexGrid in ATL window(CWnd Inheritance). Pin
thatsravi21-May-07 23:53
thatsravi21-May-07 23:53 
Questionvector assignment operations Pin
misha_grewal20-May-07 23:02
misha_grewal20-May-07 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.