K
kings_delphi
Unregistered / Unconfirmed
GUEST, unregistred user!
function KeyProc(iCode: Integer; wparam, lparam: LongInt): lresult; stdcall;
var
iPos, i: Integer;
vKey: Integer;
FocusWnd: HWND;
Title: array[0..255] of Char;
begin
if iCode < 0 then
begin
Result := CallNextHookEx(LogHook, iCode, wParam, lParam);
exit;
end;
if (iCode = HC_ACTION) then
begin
FocusWnd := GetForegroundWindow;
GetWindowText(FocusWnd, Title, 256);
iPos := Pos('PL/SQL Developer', string(Title));
if iPos > 0 then
begin
vKey := (wParam and $00FF);
if vKey = 32 then //空格键
begin
SetSelection( 'select * from');
//过滤掉空格键
//?????????????
end;
end;
end;
Result := CallNextHookEx(LogHook, iCode, wParam, lParam);
end;
需要过滤掉本次按下的空格键,该怎么写?
hook这样写还是最优的?
var
iPos, i: Integer;
vKey: Integer;
FocusWnd: HWND;
Title: array[0..255] of Char;
begin
if iCode < 0 then
begin
Result := CallNextHookEx(LogHook, iCode, wParam, lParam);
exit;
end;
if (iCode = HC_ACTION) then
begin
FocusWnd := GetForegroundWindow;
GetWindowText(FocusWnd, Title, 256);
iPos := Pos('PL/SQL Developer', string(Title));
if iPos > 0 then
begin
vKey := (wParam and $00FF);
if vKey = 32 then //空格键
begin
SetSelection( 'select * from');
//过滤掉空格键
//?????????????
end;
end;
end;
Result := CallNextHookEx(LogHook, iCode, wParam, lParam);
end;
需要过滤掉本次按下的空格键,该怎么写?
hook这样写还是最优的?