VK_F4 je virtual kod za F4.
Imam ba hook za sve poruke.
Sada kada obrađujem tu poruku ako je neki kjluč sa tastature onda mogu dobiti njegov key kode.
Code:
function MsgFilterFunc(Code: Integer; wParam, lParam: Longint): Longint;
var
MMFHandle: THandle;
MMFData: PMMFData;
Kill: boolean;
begin
Result := 0;
MMFHandle := OpenMMF(MMFName);
if MMFHandle <> 0 then
begin
MMFData := MapMMF(MMFHandle);
if MMFData <> nil then
begin
if (Code < 0) or (wParam = PM_NOREMOVE) then
{
The CallNextHookEx function passes the hook information to the
next hook procedure in the current hook chain.
}
Result := CallNextHookEx(MMFData.NextHook, Code, wParam, lParam)
else
begin
Kill := False;
with TMsg(Pointer(lParam)^) do
begin
// Kill Numbers
if (wParam >= 48) and (wParam <= 57) then Kill := True;
// Kill Tabulator
if (wParam = VK_TAB) then Kill := True;
end;
//Example to disable all the start-Key combinations
case TPMsg(lParam)^.message of
WM_SYSCOMMAND: // The Win Start Key (or Ctrl+ESC)
if TPMsg(lParam)^.wParam = SC_TASKLIST then Kill := True;
WM_HOTKEY:
case ((TPMsg(lParam)^.lParam and $00FF0000) shr 16) of
VK_D, // Win+D ==> Desktop
VK_E, // Win+E ==> Explorer
VK_F, // Win+F+(Ctrl) ==> Find:All (and Find: Computer)
VK_M, // Win+M ==> Minimize all
VK_R, // Win+R ==> Run program.
VK_F1, // Win+F1 ==> Windows Help
VK_PAUSE: // Win+Pause ==> Windows system properties
begin
Kill := True;
showmessage(IntToStr(TPMsg(lParam)^.wParam));
end;
end;
end;
if Kill then TPMsg(lParam)^.message := WM_NULL;
Result := CallNextHookEx(MMFData.NextHook, Code, wParam, lParam)
end;
UnMapMMF(MMFData);
end;
CloseMMF(MMFHandle);
end;
end;
Kako sada da u ovom primjeru saznam da li pritinuto Ctrl+Alt+Delete??
[Ovu poruku je menjao borovac dana 17.07.2005. u 19:35 GMT+1]