Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.04.09;
Скачать: CL | DM;

Вниз

Проблема с SetKeyboardState();   Найти похожие ветки 

 
EHOT ©   (2006-03-27 13:33) [0]

Помогите советом. Использую в проге переклюение Caps, Scroll.

GetKeyboardState(K);
K[VK_CAPITAL]:=1;
SetKeyboardState(K);

Переrлючение срабатывает, а светодиоды на клаве никак не реагируют...


 
MBo ©   (2006-03-27 13:39) [1]


procedure SwitchToggleKey(Key: byte; State: boolean);
var
 ks: TKeyboardState;
 ScanCode: integer;
begin
 if not key in [VK_CAPITAL, VK_NUMLOCK, VK_SCROLL, VK_INSERT] then
   exit;
 if (key = VK_NUMLOCK) and (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) then
 begin
   GetKeyboardState(ks);  {for Win95/98}
   if state then
     ks[key] := ks[key] or 1
   else
     ks[key] := ks[key] and 254;
   SetKeyboardState(ks);
 end
 else
   if odd(GetKeyState(key)) <> state then
   begin
     ScanCode := MapVirtualKey(key, 0);
     keybd_event(key, ScanCode, {KEYEVENTF_EXTENDEDKEY} 0, 0 );
   {Simulate a key release}
   keybd_event(key, ScanCode, {KEYEVENTF_EXTENDEDKEY or } KEYEVENTF_KEYUP, 0);
 end;
end;

Note that not all controls "honor" the INSERT key, and others will only respond to the INSERT key while they have focus. I"m surprised that the Extended Key "attribute" works for the non-extended keys. Strangely enough, it works as well without KEYEVENTF_EXTENDEDKEY.

Tip by Werner Hafner



 
EHOT ©   (2006-03-27 13:47) [2]

Огромносе спасибо!!! :)



Страницы: 1 вся ветка

Текущий архив: 2006.04.09;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.042 c
8-1129892436
olevacho_
2005-10-21 15:00
2006.04.09
Циклическое проигрывание звукового файла


15-1142506137
Аццкий Сотона
2006-03-16 13:48
2006.04.09
По какому принципу удаляются ветки?


1-1141464003
ircnoob
2006-03-04 12:20
2006.04.09
Раскраска TRichEdit a


4-1137994529
novikova
2006-01-23 08:35
2006.04.09
Работа через модем в режиме ЗАПРОС-ОТВЕТ


15-1142853447
Rentgen
2006-03-20 14:17
2006.04.09
для чего нужна ISaGRAF ?