Форум: "Система";
Текущий архив: 2003.10.02;
Скачать: [xml.tar.bz2];
ВнизКлавиатура Найти похожие ветки
← →
pod (2003-07-18 07:46) [0]Привет всем, у меня вопрос, который наверное уже звучал на этом форуме. Как програмно отключить только клавиатуру?Заранее спасибо!
← →
Leshiy (2003-07-18 09:00) [1]http://www.winall.ru/rundll32_vbs.shtml
← →
MetalFan (2003-07-18 10:52) [2]ага))) а включить потом???
← →
Leshiy (2003-07-18 13:00) [3]до первой перезагрузки или сделать enable.
← →
Clipper Chip (2003-07-18 17:14) [4]procedure BlockInput; external "user32.dll";
затем в проге
//отключить
asm
push 1
call BlockInput
end;
//включить
asm
push 0
call BlockInput
end;
правда отлючается и мышь.
← →
Acidy (2003-07-18 22:22) [5]где-то в кладовке есть компонент .... называется помоему как-то DrinSoftBlockInput (DSBI), там всё просто и с примерами (кстати работает всё изумительно во всех виндах :)) - проверено...
gl...
← →
Song (2003-07-19 11:09) [6]Хуком.
← →
Marser (2003-07-19 14:01) [7]
> Song © (19.07.03 11:09)
> Хуком.
Угу:
var
Dummy ( code: Integer; wparam: Word; lparam: LongInt )
> Song © (19.07.03 11:09)
> Хуком.
Угу:
var
Dummy : integer=0;
OldKbHook : HHook=0;
impementation
function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LongInt; stdcall;
begin
if code<0 then Result:=CallNextHookEx( oldKbHook, code, wparam, lparam )
else Result:=1;
end;
// включение клавы
procedure TForm1.KeyBoardOn(Sender: TObject);
begin
if OldKbHook <> 0 then begin
UnHookWindowshookEx( OldKbHook );
OldKbHook := 0;
end;
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 0, 0, 0);
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, 0, 0);
end;
// выключение клавы
procedure TForm1.KeyBoardOff(Sender: TObject);
begin
SystemParametersInfo( SPI_SETFASTTASKSWITCH, 1, @Dummy, 0);
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, @Dummy, 0);
OldKbHook := SetWindowsHookEx( WH_KEYBOARD, @KbHook, HInstance, 0 );
end;
Не работает в окнах Дос(там ловушки не действуют). Если WH_KEYBOARD заменить на WH_MOUSE, можно отключать мышь.
Другой способ - функция АПИ - EnableHardwareKeyboard Вот что на этот счет говорит MSDN:
This function enables or disables the keyboard.
BOOL EnableHardwareKeyboard (
BOOL bEnable);
Parameters
bEnable
[in] Boolean value that specifies whether to enable or disable the keyboard. Set it to TRUE to enable the keyboard or FALSE to disable it.
Return Values
This function always returns TRUE.
Remarks
The EnableHardwareKeyboard function is useful for applications in which a user can write on the touch screen. When the keyboard is disabled, a user can rest a hand on it without causing spurious keyboard input. Use the disable mode carefully. If an application hangs while the keyboard is disabled, the keyboard is not available to other applications.
When EnableHardwareKeyboard changes the enabled state of the keyboard, it causes menus, tabs, buttons and static controls to repaint themselves, so they can change the way they display keyboard accelerators or other relevant information.
← →
Gogol (2003-07-19 14:53) [8]WinExec(PChar("rundll32 keyboard,disable"), SW_Show);- Заблокировать Клавиатуру
WinExec(PChar("rundll32 keyboard,enable"), SW_Show);- Освободить
← →
Marser (2003-07-19 17:22) [9]
> Gogol (19.07.03 14:53)
Что-то ты, парень, поторопился. Нет обратной функции. Такие шутка у дяди Билла.
Страницы: 1 вся ветка
Форум: "Система";
Текущий архив: 2003.10.02;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.01 c