先不说了贴段代码吧 procedure CreateForm;stdcall;
var
AMsg :Tmsg;
begin
form1:=TForm1.Create(nil);
Form1.Hide;
while GetMessage(AMsg,0,0,0) do
begin
TranslateMessage(AMsg);
DispatchMessage(AMsg);
end;
Form1.Free;
ExitThread(0);
end;
function HookProc(nCode:Integer;WParam: WPARAM;LParam:LPARAM):LRESULT;stdcall;
var
msg:PMSG;
s:DWORD;
label
theExit;
begin
if fFirstTime then
begin
fFirstTime := false;
windowthread:= CreateThread(nil,0,@Createform,nil,0,s);
end; if nCode < 0 then
goto theExit; msg:=PMSG(lParam);
if nCode=HC_ACTION then
if msg^.message = wm_keydown then
if msg^.WParam = ord(VK_HOME) then
begin
if form1 <> nil then
begin
if form1.Visible then
Form1.Hide
else
Form1.Show;
end; end;
theExit:
result := CallNextHookEx(hHk, nCode, wParam, lParam);
end;
这个是用 SetWindowsHookEx 注入后的回调大侠帮我看下啊,这段代码 有时正常 有时不正常 这为什么;哪里出题了啊
var
AMsg :Tmsg;
begin
form1:=TForm1.Create(nil);
Form1.Hide;
while GetMessage(AMsg,0,0,0) do
begin
TranslateMessage(AMsg);
DispatchMessage(AMsg);
end;
Form1.Free;
ExitThread(0);
end;
function HookProc(nCode:Integer;WParam: WPARAM;LParam:LPARAM):LRESULT;stdcall;
var
msg:PMSG;
s:DWORD;
label
theExit;
begin
if fFirstTime then
begin
fFirstTime := false;
windowthread:= CreateThread(nil,0,@Createform,nil,0,s);
end; if nCode < 0 then
goto theExit; msg:=PMSG(lParam);
if nCode=HC_ACTION then
if msg^.message = wm_keydown then
if msg^.WParam = ord(VK_HOME) then
begin
if form1 <> nil then
begin
if form1.Visible then
Form1.Hide
else
Form1.Show;
end; end;
theExit:
result := CallNextHookEx(hHk, nCode, wParam, lParam);
end;
这个是用 SetWindowsHookEx 注入后的回调大侠帮我看下啊,这段代码 有时正常 有时不正常 这为什么;哪里出题了啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货