钩子函数改为如下试试:
function mouseproc(icode:integer;wParam:wParam;lParam:lParam):lresult;stdcall;
begin
if icode<0 then begin
Result:=CallNextHookEx(idHook,iCode,wParam,lParam);
end
else if iCode >= 0 then begin
if wparam=wm_mousemove then //如果鼠标在屏幕x值633位置右边的话,则在ycfform的caption中显示出x值
begin
// t:=findwindow('TForm1','Ycfform');
GetCursorPos(mp);
if (mp.X<>633) then
ycfform.Caption:=inttostr(mp.X);
end
else Result:=CallNextHookEx(idHook,iCode,wParam,lParam);
end;
end;
function mouseproc(icode:integer;wParam:wParam;lParam:lParam):lresult;stdcall;
begin
if icode<0 then begin
Result:=CallNextHookEx(idHook,iCode,wParam,lParam);
end
else if iCode >= 0 then begin
if wparam=wm_mousemove then //如果鼠标在屏幕x值633位置右边的话,则在ycfform的caption中显示出x值
begin
// t:=findwindow('TForm1','Ycfform');
GetCursorPos(mp);
if (mp.X<>633) then
ycfform.Caption:=inttostr(mp.X);
end
else Result:=CallNextHookEx(idHook,iCode,wParam,lParam);
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货