I want to know how I can display unicode characters?
for example:
您好 = E6 82 A8 E5 A5 BD ( almost certain )
and could not do using the api messageBoxW:
invoke MessageBoxW, NULL,addr Var,Addr Var2, addr Var3
help me , thanks!
I found this:
http://www.masm32.com/board/index.php?topic=18117.0
but can not I serve both :/
Hi RHL. You need two files, one with the code and other with the Unicode strings table, maybe you are putting all together. Try this:
File: msgBox.asm - This is your code:
INCLUDE \include\masm32rt.inc
.DATA
winTitleBuffer dw 3 dup(0) ;buffer for your title
winMsgBuffer dw 3 dup(0) ;buffer for your message
.CODE
start PROC:
invoke GetModuleHandle, NULL ;get the module handle, (don't know if it is really necessary)
MOV edi, eax ;save it in edi
invoke LoadStringW, edi, 1, offset winTitleBuffer, 3 ;load title from resources ans save it in the title buffer
invoke LoadStringW, edi, 2, offset winMsgBuffer, 3 ;load message from resources and save it in message buffer
invoke MessageBoxW, NULL, offset winMsgBuffer, offset winTitleBuffer, MB_OK ;show the MessageBox
exit
start ENDP
END start
File: res.rc - Your Unicode strings:
;in this file you put your unicode strings, and save the file in Unicode charset.
STRINGTABLE
BEGIN
1, "標題\0" ;"title"
2, "消息\0" ;"message"
END
Construction from command line:
Quote
Compile code:
> ML /c /Cp /coff msgBox.asm
Compile resource with strings:
> RC res.rc
Convert resource (.res) to .obj file:
> CVTRES /machine:ix86 res.res
Link all:
> LINK msgBox.obj res.obj /OUT:msgBox.exe /SUBSYSTEM:Windows /LIBPATH:c:\masm32\lib
Note you can use POLINK instead of LINK and specify directly the .res file without the need of CVTRES tool.
Good luck.