Re: Code Page problem in SetWindowText



I guess it all depends on what you are going to do with the strings. If you are manipulating them in memory and not using them for any Windows things then certainly ANSI would save memory and time, but it's difficult to quantify the difference and I suspect it is negligible so Unicode seems a better way to go in my opinion. If you really need to minimize memory space (like you're trying to run an MFC application on your watch or something) then perhaps, but ...

Tom

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message news:q90vd3picmebnvab9a3ka6k03i5o08o9c2@xxxxxxxxxx
I've had lots of people insist that it is faster to use ANSI apps because "the strings are
shorter". They don't realize that since all of WIndows is written in Unicode, every ANSI
API has to first convert its arguments to Unicode, then call the Unicode version of the
API, so ANSI would be inherently slower.

In an experiment I ran, Unicode is on the average slightly faster than ANSI, for something
as simple as a repeated SetWindowText, although the variance of the samples is high.
joe

.



Relevant Pages

  • Re: Skipws
    ... I have tested skipws works for both ANSI and UNICODE version strings (i.e. ... char and wchar_t). ...
    (microsoft.public.vc.language)
  • Re: Serial Port : error in opening
    ... >> must be UNICODE, not ANSI. ... If you're reading existing ANSI files, ... >> you can choose to keep the strings as ANSI internally. ... >> bom windows ce ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Convert CString to LONG.
    ... people used ASCII to store strings. ... Unicode was considered the standard to represent ... Typically, ANSI version ended with A, ... It is easy to code in Unicode-aware way if you use CString and Microsoft ...
    (microsoft.public.vc.mfc)
  • Re: Why use the unicode version of the api?
    ... locale Gustavo, e.g. Korean. ... Unicode only becomes important if your code, or data, are spanning multiple ... holds its data internally in Unicode, and VB uses Unicode strings. ... translation to an intermediate "ANSI" form. ...
    (microsoft.public.vb.winapi)
  • Re: MBCS vs UNICODE
    ... ANSI build doesn't exist in the sense that each language caracter gets exactly one `char' for representation. ... If you're planning to use your application with Asian multibyte languages, then you will need to call _mbXXX family of functions when working with strings. ... due to prevalence of Win2K/XP nowadays we can abandon Win9x/Me and do Unicode builds that suit everyone. ...
    (microsoft.public.vc.language)