News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

non-english windows clipboard problem

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

Previous topic - Next topic

bomz

Hello to all!
I have put data to clip board problem with russian windows 7 x64.
Google say that is microsoft problem with 1250 1251 1252 code pages
found some advice but can't understand what to do.
windows patch - bad way.
void ToClipboard(char* text)
{
    if(OpenClipboard(0))
    {
        EmptyClipboard();
        char* clip_data = (char*)(GlobalAlloc(GMEM_FIXED, MAX_PATH));
        lstrcpy(clip_data, text);
        SetClipboardData(CF_TEXT, (HANDLE)(clip_data));
        LCID* lcid = (DWORD*)(GlobalAlloc(GMEM_FIXED, sizeof(DWORD)));
        *lcid = MAKELCID(MAKELANGID(LANG_RUSSIAN, SUBLANG_NEUTRAL), SORT_DEFAULT);
        SetClipboardData(CF_LOCALE, (HANDLE)(lcid));
        CloseClipboard();
    }
}


six_L

try to test as following.
local TestBuffer[256]:word

invoke MultiByteToWideChar,CP_ACP,0,clip_data,-1,addr TestBuffer,256
Say you, Say me, Say the codes together for ever.

TimoVJL

Making an UNICODE application is also one option.
May the source be with you

jj2007

GuiParas equ "Hello World", x660, y50, w400, h300, m4, b LiteBlueGreen ; position, margins, background colour
GuiMenu equ @File, &Open, &Save, -, E&xit, @Edit, Undo, Copy, Paste
include \masm32\MasmBasic\Res\MbGui.asm
  GuiControl MyEdit, "edit", 'У меня проблема с "поместить данные в буфер обмена" в русской windows 7x64', font -18, bcol LiteBlueGreen
  GuiControl MyStatus, "statusbar", "Use 'Copy' in the menu to copy 'русской' into the clipboard"

Event Command
  Switch_ MenuID
  Case_ 4                       ; case Edit/Copy
        .if Instr_(Win$(hMyEdit), "русской")
                wSetClip$ wRec$(Left$(eax, 14))
                SetStatus$ "String 'русской' copied"
        .endif
  Case_ 2: invoke SendMessage, hGui, WM_CLOSE, 0, 0
  Endsw_
GuiEnd

bomz

great thanks.
obvious problem and no easy decision. I even don't understand essence of problem

clipboard not a memory, but a hide notebook window?

jj2007

The essence of the problem is that you should use Unicode, UTF-16 and UTF-8. The old code pages are messy.

bomz

interesting the problem is to switch to RU language from ENG

shift ctrl or shit alt



nidud

#7
deleted

bomz

LoadKeyboardLayout - must change locale of my pipe(?!)

invoke LoadKeyboardLayout,419, KLF_ACTIVATE
error

+-------------------------+-------------------------+
|     SubLanguage ID      |   Primary Language ID   |
+-------------------------+-------------------------+
15                    10  9                         0   bit


invoke GetKeyboardLayout,0 -> 67699721 = 100000010010000010000001001 it is english


jj2007

Quote from: nidud on February 11, 2022, 10:59:29 PMThe problem is most likely that he do not have a Russian version of Windows but an English version with a language pack.

I have an Italian OS, and my code above works just fine with Russian. How many times do we have to discuss this?

Attached the Chinese version. I definitely don't have a Chinese language pack, this is just standard Windows 7.

bomz


nidud

#11
deleted

jj2007

Quote from: bomz on February 11, 2022, 11:48:45 PM
.asc how open asc?

RichMasm, Wordpad, MS Word. It's a *.rtf file. Oops, I just realised it's called Chinese version but the text is Arabic - my bad :tongue:

Quote from: nidud on February 12, 2022, 12:49:44 AMNot sure what the angle is here and why you insist on promoting this bullshit (you get paid for this?). Russians should use a Russian version of Windows for the same reason you use an Italian version. The Windows API's wont work without language support as it forces the use of Unicode.

You are truly obsessed with this weird Norwegian point of view. Get over it, Utf-8 and Utf-16 have been around for a really long time.

nidud

#13
deleted

hutch--

This is google translate.

This is a test of English to Russian text done in Google translation.

Это тест англо-русского текста, выполненный в переводе Google.

I could paste it directly into my editor but if you save it as text, reopening it produce ?????????? text. It needs a UNICODE editor. Tested in the UNICODE editor it displays correctly.