function MouseProc(nCode: integer; wParam: WParam; lParam: LParam): LRESULT; stdcall;
begin
Result := 0;
if nCode < 0 then
Result := CallNextHookEx(MHookHandle, nCode, wParam, lParam)
else
begin
//Rule of API call, which referred to Win32 Hooks topic in MSDN
case wParam of //鼠标左键或右键单击
WM_LBUTTONUP, WM_NCLBUTTONUP, WM_RBUTTONUP:
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 0, 500);
WM_MOUSEMOVE:
begin
if FIsNew = False then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 0, 500);
end;
//Sends Message to Instance to which was injected this DLL
end; // case
end;end;
function KeyboardProc(nCode: Integer; WPARAM: wParam; LPARAM: lParam): LRESULT; stdcall;
var
i: Integer;
nState: SHORT;//得到键盘状态的GetKeyState函数的返回值。这是一个16位的数。
begin
Result := 0;
if nCode < 0 then
Result := CallNextHookEx(KHookHandle, nCode, wParam, lParam)
else
begin
if (nCode = HC_ACTION) and (((lParam shr 30) and $F) = 0) then
begin
for I := 0 to 1 do begin // Iterate
nState := GetKeyState(G_KeyValArr.ModKey);//
if (nState and $80000000) = $80000000 then
begin
if (WPARAM = Ord(G_KeyValArr.key)) then
begin
if i = 0 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 1, WPARAM)
else if i = 1 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 2, WPARAM);
FLastStuTime := GetTickCount;
Break;
end
else
begin
if (GetTickCount - FLastStuTime) > 1000 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 3, WPARAM);
end;
end;
end;
end
else
begin
if (GetTickCount - FLastStuTime) > 1000 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 3, WPARAM);
end;
Result := CallNextHookEx(KHookHandle, nCode, wParam, lParam);
end;end;
begin
Result := 0;
if nCode < 0 then
Result := CallNextHookEx(MHookHandle, nCode, wParam, lParam)
else
begin
//Rule of API call, which referred to Win32 Hooks topic in MSDN
case wParam of //鼠标左键或右键单击
WM_LBUTTONUP, WM_NCLBUTTONUP, WM_RBUTTONUP:
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 0, 500);
WM_MOUSEMOVE:
begin
if FIsNew = False then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 0, 500);
end;
//Sends Message to Instance to which was injected this DLL
end; // case
end;end;
function KeyboardProc(nCode: Integer; WPARAM: wParam; LPARAM: lParam): LRESULT; stdcall;
var
i: Integer;
nState: SHORT;//得到键盘状态的GetKeyState函数的返回值。这是一个16位的数。
begin
Result := 0;
if nCode < 0 then
Result := CallNextHookEx(KHookHandle, nCode, wParam, lParam)
else
begin
if (nCode = HC_ACTION) and (((lParam shr 30) and $F) = 0) then
begin
for I := 0 to 1 do begin // Iterate
nState := GetKeyState(G_KeyValArr
if (nState and $80000000) = $80000000 then
begin
if (WPARAM = Ord(G_KeyValArr
begin
if i = 0 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 1, WPARAM)
else if i = 1 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 2, WPARAM);
FLastStuTime := GetTickCount;
Break;
end
else
begin
if (GetTickCount - FLastStuTime) > 1000 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 3, WPARAM);
end;
end;
end;
end
else
begin
if (GetTickCount - FLastStuTime) > 1000 then
SendMessage(pSharedMem^.InstHandle, pSharedMem^.MessageID, 3, WPARAM);
end;
Result := CallNextHookEx(KHookHandle, nCode, wParam, lParam);
end;end;