News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to use Unicode "strings" properly ?

Started by 4C617273H, September 19, 2010, 05:29:45 PM

Previous topic - Next topic

4C617273H

Hello,

Windows has become more of a Unicode operating system than staying an "ANSI" os.

How do I work with Unicode throughout the application, ie. for "strings"?

Iczelion's tutorials use DB and ,0 for strings. Those are Define Byte and 0-terminated, correct?

Windows 7 uses UTF-16 though (reference: http://msdn.microsoft.com/en-us/library/dd317743(v=VS.85).aspx).

Now I use the EasyCode IDE with the Unicode application project property set. This should make EasyCode / MASM use the Unicode versions of an API ("W") if I don't specify a suffix myself, right?

However when using the TCITEM structure and its cchTextMax and pszText properties (and its imask) and using handcoded UTF-16 characters and the length of the string, the displayed string ends after the first character, probably because finding a 0 in the HiWord. String display reference: http://msdn.microsoft.com/en-us/library/bb760631(v=VS.85).aspx ,  TCITEM reference: http://msdn.microsoft.com/en-us/library/bb760554(v=VS.85).aspx

Am I missing something? If yes, what is it?

Thanks!

Lars

qWord

May it help to send the TCM_SETITEMW-Message explicit.
FPU in a trice: SmplMath
It's that simple!

4C617273H

Well, I use SendMessage. I would have to use SendMessageW if it exists. I didn't try this. Or would I have to change the message like you named it instead of changing the API ?

Thanks! Best

qWord

In case of SendMessage it doesn't matter if you are using the unicode or ANSI version - the message it self is the deciding factor.
FPU in a trice: SmplMath
It's that simple!

Vortex

Also, have a loot at the UNICODE functions provided by masm32.lib :

Unicode String Functions

\masm32\help\masmlib.chm

ToutEnMasm


You need to have header files who accept the UNICODE syntax and then you can used the normal syntax ,the header made the modifies for you.
Just add UNICODE equ 1 to your code
If you don't want to use this,read the header and made manually the modifies.
The "ready to use sdk" allow this ( masm32 forum windows.inc project)

4C617273H

Quote from: qWord on September 19, 2010, 05:50:55 PM
In case of SendMessage it doesn't matter if you are using the unicode or ANSI version - the message it self is the deciding factor.

Thanks!


Quote from: Vortex on September 19, 2010, 05:56:39 PM
Also, have a loot at the UNICODE functions provided by masm32.lib :

Unicode String Functions

\masm32\help\masmlib.chm

I did, didn't find anything helpful related though. A Unicode conversion function would be helpful (as an extra tool). Thank you too!


I will have a look whether sending the W message explicitly is resulting in the correct string displayed. Not tonight anymore though probably.

Quote from: ToutEnMasm on September 19, 2010, 06:04:07 PM

You need to have header files who accept the UNICODE syntax and then you can used the normal syntax ,the header made the modifies for you.
Just add UNICODE equ 1 to your code
If you don't want to use this,read the header and made manually the modifies.
The "ready to use sdk" allow this ( masm32 forum windows.inc project)


Thank you! I will check this!

Lars

4C617273H

UNICODE equ 1

and

TCM_SETITEMW

were a success!

Thanks again!