News:

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

Display Japanese chars on edit control

Started by Messias, June 29, 2011, 07:11:45 PM

Previous topic - Next topic

Messias

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













dedndave

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

jj2007

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; exe attached)

Messias

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.


Messias

i had an idea and it worked!

DialogBoxParamW instead of DialogBoxParam. edit control can now display japanece characters or other languages characters. ;)