这段代码是 delphi 的,是获取屏幕上的一个点所在的文档对象,希望对楼主有些用: function ObjectFromLresult; external 'OLEACC.DLL' name 'ObjectFromLresult'; class function IETool.GetIHTMLDocumentFromPoint(h: HWND; p: TPoint): IHTMLDocument2; var res: Cardinal; doc: IHTMLDocument2; begin Result := nil; SendMessageTimeout(h, msg, 0, 0, SMTO_ABORTIFHUNG, 1000, res); if Succeeded(ObjectFromLresult(res, IHTMLDocument2, 0, doc)) then begin Result := doc; end; end;
还缺一个方法: class function IETool.GetIEHandleFromPoint(p: TPoint): HWND; var h: HWND; cls: array[0..100] of Char; begin Result := 0; h := WindowFromPoint(p); if h <> 0 then begin RealGetWindowClass(h, cls, 100); if cls = 'Internet Explorer_Server' then begin Result := h; end; end; end;
function ObjectFromLresult; external 'OLEACC.DLL' name 'ObjectFromLresult';
class function IETool.GetIHTMLDocumentFromPoint(h: HWND; p: TPoint): IHTMLDocument2;
var
res: Cardinal;
doc: IHTMLDocument2;
begin
Result := nil;
SendMessageTimeout(h, msg, 0, 0, SMTO_ABORTIFHUNG, 1000, res);
if Succeeded(ObjectFromLresult(res, IHTMLDocument2, 0, doc)) then
begin
Result := doc;
end;
end;
class function IETool.GetIEHandleFromPoint(p: TPoint): HWND;
var
h: HWND;
cls: array[0..100] of Char;
begin
Result := 0;
h := WindowFromPoint(p);
if h <> 0 then
begin
RealGetWindowClass(h, cls, 100);
if cls = 'Internet Explorer_Server' then
begin
Result := h;
end;
end;
end;