News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

non-english windows clipboard problem

Started by bomz, February 11, 2022, 12:50:11 PM

Previous topic - Next topic

nidud

#15
deleted

jj2007

Nidud, I am so sorry that your tools don't allow to work with all languages supported by Windows :tongue:




bomz

#17
Thanks. Why this don't work?
invoke LoadKeyboardLayout,0419h, KLF_ACTIVATE

http://d.radikal.ru/d34/2202/dd/bc95aced2e17.jpg
http://d.radikal.ru/d17/2202/11/ab7ada8b1edf.jpg
http://a.radikal.ru/a33/2202/87/64ad05119bf2.jpg


invoke ActivateKeyboardLayout,HKL_NEXT,0  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
invoke ActivateKeyboardLayout,0419h,0 - RUS
invoke ActivateKeyboardLayout,0409h,0 - ENG


TimoVJL

Win32 have function MultiByteToWideChar(CP_UTF8, 0, ... and WideCharToMultiByte(CP_UTF8, 0, .. for UTF-8 strings.
Web pages are mostly UTF-8 and also MS help files.


EDIT:
The sad history of Unicode printf-style format specifiers in Visual C++

Free Clipboard Viewer
May the source be with you

jj2007

Quote from: TimoVJL on February 12, 2022, 08:26:41 PM
Win32 have function MultiByteToWideChar(CP_UTF8, 0, ... and WideCharToMultiByte(CP_UTF8, 0, .. for UTF-8 strings.
Web pages are mostly UTF-8 and also MS help files.

Even Explorer, it seems (except in Norway). On the surface, at least - under the hood, it's surely UTF-16.

bomz

invoke GetClipboardData,CF_UNICODETEXT
invoke MessageBoxW,0,eax,addr mestitle,MB_ICONASTERISK

jj2007

include \masm32\MasmBasic\MasmBasic.inc         ; download
$Data 你在胡说八道,我的朋友!
$Data Mluvíš nesmysly, příteli!
$Data Вы говорите глупости, мой друг!
$Data أنت تتحدث عن هراء يا صديقي!
$Data אתה מדבר שטויות, ידידי!
$Data あなたはナンセンスを話している、私の友人!
  Init
  Read my$()
  wMsgBox 0, wRec$(Join$(my$())), "Windows works fine everywhere in the World", MB_OK
EndOfCode


And guess what, friend from Norway, it doesn't even need MasmBasic - see attachment PureMasm32SDK :tongue:

hutch--

I honestly don't know what the big deal is here, Windows has supported UNICODE since 1994 in NT4 and with UNICODE fonts, you can produce just about any language on the planet. Natural languages that can be represented with single byte character sets can use the old code page system but it was a pain to use where UNICODE easily handled entirely different language and character formats, Chinese, Japanese, Georgian, Russian etc .....

I am lazy in that as an English speaker, ASCII does the job in most instances where UNICODE requires storing string data in a different manner.

TimoVJL

Windows NT was born from start with UNICODE, like Windows NT 3.1
May the source be with you


Greenhorn

Since NT, Windows is internally using Unicode only (since Windows 2000 this is UTF-16). All the ASCII functions of the win32 API are just Wrappers which allocate additional memory to convert the ASCII string and then call the Unicode version of the function and vice versa. They do only exist because of compatibility reasons with old applications.

"New applications"(sic!) should use Unicode in general.
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

six_L

#26
Hi,bomz
the OS(non ansi) uses unicode API defaultly.
or use
LOCAL ansiBuf[2048]:BYTE

invoke OpenClipboard,NULL
invoke GetClipboardData,CF_UNICODETEXT ;CF_TEXT
mov hClipdata,rax
invoke GlobalLock,hClipdata
mov lpStr,rax
invoke SetDlgItemTextW,hWnd,IDC_OUTPUT2,lpStr
invoke RtlZeroMemory,addr ansiBuf,sizeof ansiBuf
invoke WideCharToMultiByte,CP_ACP,0,lpStr,-1,addr ansiBuf,2048,NULL,NULL
invoke SetDlgItemTextA,hWnd,IDC_OUTPUT1,addr ansiBuf
invoke GlobalUnlock,hClipdata
invoke EmptyClipboard
invoke CloseClipboard

Say you, Say me, Say the codes together for ever.

bomz

#27
invoke ActivateKeyboardLayout,0419h,0
interesting how use cf-text and cf_oemtext for input

bomz

can anybody say how works cf-locale?
;invoke ActivateKeyboardLayout,0419h,0
invoke OpenClipboard,NULL
;invoke GetClipboardData,CF_LOCALE
;invoke MessageBox,0,eax,0,MB_ICONASTERISK
;invoke wsprintf,ADDR buffer,ADDR form,dword ptr[eax]
;invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
invoke SetClipboardData, CF_LOCALE, 0419h
invoke GetClipboardData,CF_OEMTEXT
invoke MessageBox,0,eax,0,MB_ICONASTERISK
invoke CloseClipboard
invoke ExitProcess,0

Greenhorn

Forget about CF_LOCAL, instead use CF_UNICODE and your problems fade away.
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.