lazarus 点击 ie
procedure ierenrenxiaozhanzhuce;
label v1,v0,v9,v2,v3,v8,v4,v5,v6,v7;
var a,b,c,sa,sb,sc:string; i,j,k:integer; FileHandle:integer; ole_index:olevariant;
tt:tstringlist;

iFileHandle: Integer;
iFileLength: Integer;
iBytesRead: Integer;
Buffer: PChar; s:ansistring;
kkk:atom; aa:iwebbrowser2; cc:handle;
h:hwnd; bb,bb2:tbitmap; ttt:trect; ppp:tpoint; mulu:string; yuansu:ihtmlelement;
mingzi,mima:string; x,y:integer;
liulanqi:twebbrowser;
suoyins,suoyinss:string; ooo:olevariant;
vframe, frame_dispatch: IDispatch;
doc2:IHTMLDocument2;
wd : IHTMLWindow2;
bw : IWebBrowser2;
function HtmlWindowToHtmlWebBrowser(const ADsp : IDispatch) : IWebBrowser2;
var
isp : IServiceProvider;
begin
Result := nil;
if not Assigned(ADsp) then Exit;
isp := ADsp as IServiceProvider;

isp.QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, Result);
end;
var shangchuan:TshangchuanThread;

h1,h2,h3,h4,h5,h6,h7,h8,h9,h0:hwnd; web:iwebbrowser2; rrr1,rrr2,rrr3,rrr4,rrr5,rrr:trect;
begin
h1:=findwindow(nil,pchar(utf8toansi('人人小站 - Internet Explorer')));
showmessage(inttohex(h1,8));
h2:=findwindowex(h1,0,pchar(utf8toansi('Frame Tab')),nil);
showmessage(inttohex(h2,8));
h3:=findwindowex(h2,0,nil,pchar(utf8toansi('人人小站 - Internet Explorer')));
showmessage(inttohex(h3,8));
h4:=findwindowex(h3,0,pchar(utf8toansi('Shell DocObject View')),nil);
showmessage(inttohex(h4,8));
h5:=findwindowex(h4,0,pchar(utf8toansi('Internet Explorer_Server')),nil);
showmessage(inttohex(h5,8));
GetIEFromHWND(h5,web);
form1.webbrowser1.OleServer:=web ;

 

gundongwangye(form1.webbrowser1,-999);
delay(1111);
//id=realName // id=SWFUpload_0

yuansu:=idyuansu(form1.webbrowser1,'SWFUpload_0');

huodezuobiao(yuansu,22,x,y);
showmessage(inttostr(x)+' '+inttostr(y));
SwitchToThisWindow(h1,false);
delay(1111);
gundongwangye(form1.webbrowser1,-999);

getwindowrect(h1,rrr1);
getwindowrect(h2,rrr2);
getwindowrect(h3,rrr3);


SetCursorPos(x+rrr1.Left {+rrr2.Left}+rrr3.Left ,y+rrr1.Top {+rrr2.Top}+rrr3.Top );

likaihuodejiaodian(yuansu);

yuansu.click;
// while true do application.ProcessMessages;

postMessage(h5 ,WM_MOUSEMOVE,MK_LBUTTON, MAKELONG(x+5,y+3));
application.ProcessMessages;
postMessage(h5 ,WM_LBUTTONDOWN,MK_LBUTTON, MAKELONG(x+5,y+3));
application.ProcessMessages;sleep(111); application.ProcessMessages;sleep(111);application.ProcessMessages;sleep(111);
postMessage(h5,WM_LBUTTONup,MK_LBUTTON, MAKELONG(x+5,y+3));