10-05-2011, 11:32 AM
Member function Htm.FromXY2
Function EH_MulDiv2
Function EH_GetZoom2
function x y
;Gets element from point in screen, and initializes this variable.
;Error if fails.
;EXAMPLE
;out
;Htm el.FromXY2(xm ym)
;out el.HTML
POINT p.x=x; p.y=y
if _iever>=0x532
,;get doc of element from point. If in frame, it must not be top-level doc. With acc it is easier.
,Acc a=acc(p.x p.y 0) ;;any elem in that doc
,MSHTML.IHTMLElement _el=htm(a); if(!_el) goto gFailed
,MSHTML.IHTMLDocument2 doc=_el.document
,
,;get doc location in screen, and mouse pos in doc
,_el=doc.body; a=acc(_el)
,if(a.Role!=ROLE_SYSTEM_CLIENT) a.Navigate("parent") ;;PANE -> CLIENT
,a.Location(x y)
,p.x-x; p.y-y
else ;;IE5 (each frame in own IES; htm(a) fails)
,int h=child(p.x p.y 0)
,rep ;;because h may be child combo etc
,,if(!h) goto gFailed
,,if(childtest(h "" "Internet Explorer_Server")) break
,,h=GetParent(h)
,doc=htm(h)
,ScreenToClient h &p
;get element from point
if(_iever>=0x800) EH_MulDiv2 100 EH_GetZoom2(doc) +&p 2
_el=doc.elementFromPoint(p.x p.y); if(!_el) goto gFailed
el=_el
ret
err+
;gFailed
end "failed"Function EH_MulDiv2
;/
function mul div *p n
;MulDiv for multiple values.
if(mul=div or !mul or !div) ret
for(n n 0 -1) *p=MulDiv(*p mul div); p+4Function EH_GetZoom2
