06.10.2012, 01:05
|
|
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
продолжение:
Код:
program CapSwitch;
uses
Windows, MyThread;
type
TKBDLLHOOKSTRUCT = record
vkCode : DWORD;
scanCode : DWORD;
flags : DWORD;
time : DWORD;
dwExtraInfo : DWORD;
end;
PKBDLLHOOKSTRUCT = ^TKBDLLHOOKSTRUCT;
const
WH_KEYBOARD_LL = 13;
var
hhkLowLevelKybd : HHOOK;
Mutex : THandle;
aLedscroll : TLedScroll;//TThread;
//------------------------------------------------------------------------------
function LowLevelKeyboardProc(nCode: integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
fEatKeystroke : Boolean;
p : PKBDLLHOOKSTRUCT;
Wnd : HWND;
begin
fEatKeystroke := False;
if nCode = 0 then
begin
case wParam of
256 :
begin
p := PKBDLLHOOKSTRUCT(lParam);
fEatKeystroke := (p^.vkCode = 20);
end;
end;
end;
if fEatKeystroke then
begin
Wnd := GetForegroundWindow;
PostMessage(Wnd, 80, 0, HKL_NEXT);
Result := 1;
end
else
Result := CallNextHookEx(0, nCode, wParam, lParam);
end;
//------------------------------------------------------------------------------
begin
// Install the low-level keyboard & mouse hooks
hhkLowLevelKybd := SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hInstance, 0);
Mutex := CreateMutex(nil, True, 'CapSwitch_Running');
if WaitForSingleObject(Mutex, 0) <> WAIT_OBJECT_0 then
Exit;
aLedscroll := TLedscroll.Create(True);
aLedscroll.Resume;
while GetMessage(msg, 0, 0, 0) do
begin
TranslateMessage(msg);
DispatchMessage(msg);
end;
// Remove hooks
if aLedscroll.Handle <> 0 then
aLedscroll.Terminate;
UnhookWindowsHookEx(hhkLowLevelKybd);
end.
И забей на KOL большой болт, кака неимоверная и давно умершая.
__________________
Je venus de nulle part
55.026263 с.ш., 73.397636 в.д.
|