The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Messias on June 29, 2011, 07:11:45 PM

Title: Display Japanese chars on edit control
Post by: Messias on June 29, 2011, 07:11:45 PM
Hi

im creating a software that downloads youtube closed captions and save captions  as SRT file.
im displaying my GUI using DialogBoxParam API. it contains a listview, statusbar, buttons, edit controls etc.

so far everything is good except when i try to display the title of the video on a edit control (readonly) the characters appears as ???????
for example the title from this video: http://www.youtube.com/watch?v=PxwwFdskgo4

youtube sends data in a XML file UTF8 encoded
My Listview has no problem displaying the languages names in their original language.
im using MultiByteToWideChar and LVM_SETITEMW and my program display characters correctly (japanese, arabian, etc) on the ListView but im having problems when i try to display japanese/arabian characters on a edit control, they show as ?????????? and im using the same method MultiByteToWideChar  and SendDlgItemMessageW + WM_SETTEXT or SetWindowTextW both show ?????????

im uisng tahoma 10 for my window font.
note: notepad can display the characters/letters correctly.

thank you

(http://img16.imageshack.us/img16/1338/19191031.th.png) (http://imageshack.us/photo/my-images/16/19191031.png/)
(http://img15.imageshack.us/img15/5264/14016554.th.png) (http://imageshack.us/photo/my-images/15/14016554.png/)









Title: Re: Display Japanese chars on edit control
Post by: dedndave on June 29, 2011, 08:19:10 PM
welcome to the forum   :U

there are so many things that go wrong   :P
the edit control must be created for unicode (FunctionNameW)
the same applies for sending messages to it, etc
may be - InitCommonControls - or you may need a manifest

without seeing the code, it is really hard to say
Title: Re: Display Japanese chars on edit control
Post by: jj2007 on June 29, 2011, 10:38:54 PM
Only two API calls, CreateWindowEx and SetWindowLong, need the W:
Quote        if UseUnicode
         invoke CreateWindowExW, WS_EX_CLIENTEDGE, wChr$("
edit"), NULL,
            WS_CHILD or WS_VISIBLE or WS_BORDER\
            or ES_LEFT or ES_AUTOHSCROLL or ES_MULTILINE, 0, 0, 0, 0,
            hWnd, IdEdit, hInstance, NULL
         mov hEdit, eax                     ; we have created an edit window
         invoke SetWindowLongW, hEdit,      ; we subclass the edit control
         GWL_WNDPROC, SubEdit
[/color]

(from \masm32\RichMasm\Res\SkelWinMB.asc, part of MasmBasic (http://www.masm32.com/board/index.php?topic=12460); exe attached)
Title: Re: Display Japanese chars on edit control
Post by: Messias on June 30, 2011, 04:18:18 AM
thanks. right now i'm using a resource file so i guess i will have to create 2 edit controls using CreateWindowExW.

it is strange that the listview can show the japanese/arabic characters and the edit control cant and all the controls are inside a resource file.

Title: Re: Display Japanese chars on edit control
Post by: Messias on June 30, 2011, 04:32:07 AM
i had an idea and it worked!

DialogBoxParamW instead of DialogBoxParam. edit control can now display japanece characters or other languages characters. ;)
Title: Re: Display Japanese chars on edit control
Post by: dedndave on June 30, 2011, 10:55:30 AM
 :U