知道IE的句柄,怎样获得IE地址栏的句柄?Thank you ,来者有分

解决方案 »

  1.   

    var
      IEHandle: THandle;
    begin
      IEHandle := FindWindow('IEFrame', nil);
      IEHandle := FindWindowEx(IEHandle, 0, 'WorkerW', nil);
      IEHandle := FindWindowEx(IEHandle, 0, 'ReBarWindow32', nil);
      IEHandle := FindWindowEx(IEHandle, 0, 'ComboBoxEx32', nil);
    end;
    最后的IEHandle就是地址栏句柄
    机子上没D,随手写的,不知道有错不,操作系统为xp
      

  2.   

    取得IE地址栏的handle    
        
    varForm1: TForm1;implementation{$R *.DFM}Function GetURL(H:hwnd;lparam:longint):boolean;stdcall;var str,url:array [0..254] of char;begingetclassname(h,@str,255);if strpas(@str)='ComboBoxEx32' then // ComboBoxEx32可以改成Edit.beginSendMessage(h,WM_GETTEXT,255,LongInt(@url));SendMessage(h,WM_SETTEXT,255,longint(pchar('http://www.sohu.com')));Sendmessage(h,WM_KEYDOWN,VK_Return,1);//你说的是加这一句吗??不行啊。 改成Edit就可以,相当于在地址栏敲回车form1.ListBox1.Items.Add(strpas(@url));end;result:=true;end;function callbackproc(H:HWnd;lparam:longint):Boolean;stdcall;var str:array [1..255] of char;begingetclassname(h,@str,255);if ((strpas(@str)='CabinetWClass') or (strpas(@str)='IEFrame')) thenbeginEnumchildwindows(h,@GetURL,0);end;result:=true;end;procedure TForm1.findbuttonClick(Sender: TObject);beginlistbox1.Clear;Enumwindows(@callbackproc,0);end;end.