Форум: "Основная";
Текущий архив: 2003.01.02;
Скачать: [xml.tar.bz2];
ВнизHook и ! Как отловить русские буквы ? Найти похожие ветки
← →
delpher_gray (2002-12-15 12:31) [0]Привет Делферы !
Есть вопрос по хукам: Как сделать хук, который будет ловить русский шрифт ??
Вот моя процедура приёма сообщений от DLL:
procedure TForm1.WndProc(var Msg: TMessage);
begin
inherited ;
if Msg.Msg = WM_MYKEYHOOK then // Если это "моё" сообщение, то...
begin
keys := keys + String(Chr(Msg.wParam));
end;
end;
Как отловить не только англ. буквы, но и русские ?
← →
Виктор Щербаков (2002-12-15 12:41) [1]GetKeyboardLayoutName
← →
Song (2002-12-15 13:56) [2]Вы поймите: Вы отлавливаете не символы, а нажатие кнопок. А уж переводить - Ваша задача.
← →
delpher_gray (2002-12-17 11:28) [3]2Song !
Song ! Вы раз 5-6 мне помогли :-) Ну а как мне можно их перевести ?
← →
Song (2002-12-17 11:33) [4]Сложением по ASCII таблице.
← →
Romkin (2002-12-17 11:53) [5]ToAscii - перекодирует по текущей раскладке
← →
delpher_gray (2002-12-17 15:28) [6]Это значит что нужно в моём хуке надо всю таблицу ASCII переписывать ???
← →
Song (2002-12-17 15:31) [7]Почему переписывать? Полученный символ переконвертировать в символ нужного языка.
← →
delpher_gray (2002-12-17 16:40) [8]А как это сделать :-))) ???
← →
delpher_gray (2002-12-17 16:41) [9]Нужно сначала определить раскладку клавиатуры, а потом переконвертировать ???
← →
DVM (2002-12-17 20:12) [10]Да сделайте наконец длинный длинный CASE.
Если такой то код и русский язык включен, то будет такая то русская буква
← →
delpher_gray (2002-12-19 14:45) [11]To DVM:
Это самый "тупой" ответ...
Нужно как-то решить эту проблему...
Если можно, то напишите полный пример процедуры.
← →
delpher_gray (2002-12-21 09:05) [12]Никто не знает ??
← →
Song (2002-12-21 09:18) [13]Да простит меня App...
The ToAscii function translates the specified virtual-key code and keyboard state to the corresponding Windows character or characters. The function translates the code using the input language and physical keyboard layout identified by the given keyboard layout handle.
int ToAscii(
UINT uVirtKey, // virtual-key code
UINT uScanCode, // scan code
PBYTE lpKeyState, // address of key-state array
LPWORD lpChar, // buffer for translated key
UINT uFlags // active-menu flag
);
Parameters
uVirtKey
Specifies the virtual-key code to be translated.
uScanCode
Specifies the hardware scan code of the key to be translated. The high-order bit of this value is set if the key is up (not pressed).
lpKeyState
Points to a 256-byte array that contains the current keyboard state. Each element (byte) in the array contains the state of one key. If the high-order bit of a byte is set, the key is down (pressed).
The low bit, if set, indicates that the key is toggled on. In this function, only the toggle bit of the CAPS LOCK key is relevant. The toggle state of the NUM LOCK and SCROLL LOCK keys is ignored.
lpChar
Points to the buffer that will receive the translated Windows character or characters.
uFlags
Specifies whether a menu is active. This parameter must be 1 if a menu is active, or 0 otherwise.
Return Values
If the specified key is a dead key, the return value is negative. Otherwise, it is one of the following values:
Value Meaning
0 The specified virtual key has no translation for the current state of the keyboard.
1 One Windows character was copied to the buffer.
2 Two characters were copied to the buffer. This usually happens when a dead-key character (accent or diacritic) stored in the keyboard layout cannot be composed with the specified virtual key to form a single character.
Remarks
The parameters supplied to the ToAscii function might not be sufficient to translate the virtual-key code, because a previous dead key is stored in the keyboard layout.
Typically, ToAscii performs the translation based on the virtual-key code. In some cases, however, bit 15 of the uScanCode parameter may be used to distinguish between a key press and a key release. The scan code is used for translating ALT+
number key combinations.
Although NUM LOCK is a toggle key that affects keyboard behavior, ToAscii ignores the toggle setting (the low bit) of lpKeyState
(VK_NUMLOCK, because the uVirtKey parameter alone is sufficient to distinguish the cursor movement keys (VK_HOME, VK_INSERT, and so on) from the numeric keys (VK_DECIMAL, VK_NUMPAD0 - VK_NUMPAD9).
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2003.01.02;
Скачать: [xml.tar.bz2];
Память: 0.48 MB
Время: 0.003 c