flat assembler
Message board for the users of flat assembler.

Index > Windows > how to display other country language

Author
Thread Post new topic Reply to topic
wzrick



Joined: 19 Jan 2009
Posts: 2
wzrick
i want to display chinese language in my dialog,but i dont know how to do it,please help me.

my code is here:

format PE GUI 4.0
entry start

include 'win32ax.inc'
; include 'encoding\utf8.inc'

title equ 'CLOCK'

section '.data' data readable writeable

buf db '0',5 dup 0

section '.code' code readable executable

start:
invoke FindWindow,0,title ; We dont want more than one copy
or eax,eax
jnz quit
invoke GetModuleHandle,0
invoke DialogBoxParam,eax,IDD_DLG1,HWND_DESKTOP,DialogProc,0
quit:
invoke ExitProcess,0


;----------------------
;Main Dialog
;----------------------
proc DialogProc hwnd,wmsg,wparam,lparam
push ebx esi edi

cmp [wmsg],WM_INITDIALOG
je .WMINITDIALOG
cmp [wmsg],WM_COMMAND
je .WMCOMMAND
cmp [wmsg],WM_CLOSE
je .WMCLOSE
xor eax,eax
jmp .finish


.WMINITDIALOG:

jmp .processed

.WMCOMMAND:

cmp [wparam], IDC_BTN1
je .start_time
cmp [wparam], IDC_BTN2
je .stop_time
cmp [wparam], IDC_BTN3
je .quit_time
jmp .processed

.start_time:
invoke MessageBox,0,'开始','Button',MB_ICONINFORMATION+MB_OK
jmp .processed

.stop_time:
invoke MessageBox,0,'停止','Button',MB_ICONINFORMATION+MB_OK
jmp .processed

.quit_time:
invoke MessageBox,0,'退出','Button',MB_ICONINFORMATION+MB_OK

.WMCLOSE:
invoke EndDialog,[hwnd],0
.processed:
mov eax,1
.finish:
pop edi esi ebx
ret
endp



section '.idata' import data readable writeable

library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL'
;include all pre-define procedures in kernel32.inc and user32.inc
include 'api\kernel32.inc'
include 'api\user32.inc'



section '.rsrc' resource data readable

IDD_DLG1= 1000

IDC_STC1= 1001
IDC_BTN1= 1002
IDC_BTN2= 1003
IDC_BTN3= 1004


directory RT_DIALOG,dialogs

resource dialogs,IDD_DLG1,LANG_CHINESE+SUBLANG_DEFAULT,main

dialog main,\
title,6,6,225,162,WS_CAPTION+WS_POPUP+WS_SYSMENU+WS_MINIMIZEBOX+DS_MODALFRAME,\
,,'宋体',10 ;WS_EX_TOPMOST is at the top of all windows

dialogitem 'Static','00:00:00',IDC_STC1,40,20,136,30,WS_CHILD+WS_VISIBLE+SS_CENTERIMAGE+SS_CENTER
dialogitem 'Button','开始',IDC_BTN1,26,83,54,19,WS_CHILD+WS_VISIBLE+WS_TABSTOP
dialogitem 'Button','停止',IDC_BTN2,134,83,54,19,WS_CHILD+WS_VISIBLE+WS_TABSTOP
dialogitem 'Button','退出',IDC_BTN3,80,118,54,19,WS_CHILD+WS_VISIBLE+WS_TABSTOP
enddialog
Post 19 Jan 2009, 03:47
View user's profile Send private message MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Some things I see you have wrong: first, you are including win32ax.inc instead of win32wx.inc and second, you are not currently including what encoding you are using (perhaps the one you have commented now is the one you must use but that depends of your editor).

Perhaps there are other errors but the ones I've told must be fixed before anything else.
Post 19 Jan 2009, 04:00
View user's profile Send private message Reply with quote
wzrick



Joined: 19 Jan 2009
Posts: 2
wzrick
First thanks ,then i do like you said,but the problem is still on, also i replace the APIs with 'W' edition,but i cant solve the problem

OS:windows xp professional sp2 simplified chinese edition
compiler:Fasm V 1.67.29
Post 19 Jan 2009, 05:36
View user's profile Send private message MSN Messenger Reply with quote
kaala



Joined: 02 Feb 2009
Posts: 1
kaala
1. use win32wx.inc
2. enable include 'encoding\utf8.inc'
3. use other editor which has utf-8 like scite and save the file using utf-8 encoding
4. run it

you should be able to view the text.
Post 02 Feb 2009, 10:29
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
This is a related thread with some solutions.

Another board member found a very simple solution for using NotePad with BOM - just make EQU at first line:
Code:
_NULL_BOM equ
...    
...and it will include the BOM bytes together with the equate name -- helping FASM process the file.


Description: Notepad UTF-8 example and PSPad UTF-8 encoded file.
Download
Filename: clock.zip
Filesize: 3.07 KB
Downloaded: 34 Time(s)

Post 02 Feb 2009, 17:06
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
bitRAKE wrote:
Another board member found a very simple solution for using NotePad with BOM - just make EQU at first line:
Code:
_NULL_BOM equ
...    
...and it will include the BOM bytes together with the equate name -- helping FASM process the file.

In fact, the simplest trick would be to just put the colon on the very beginning of file - so that the BOM would become the label.
This works great, when put at the start of source saved into BOM-marked file:
Code:
:include 'encoding\utf8.inc'    
Post 02 Feb 2009, 17:31
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.