Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi SetText: Addresszeile IE (https://www.delphipraxis.net/113084-settext-addresszeile-ie.html)

Xzeer 2. Mai 2008 12:03


SetText: Addresszeile IE
 
Hallo,

Ich versuche mit Hilfe eines Handels die Addresszeile vom Internet Explorer zu verändern. Aber irgendwie gelint es mir nicht das Handel zu finden.

Momentan benutze ich folgeden Code:

Delphi-Quellcode:
var
   window: hwnd;

window:=findwindowex(findwindow('IEFrame',nil),0,'Edit',nil);
Allerdings wird das Handle nicht gefunden. Wenn ich allerdings nur findwindow benutze, dann findet er das IE Fenster. Ich brauche aber ja das Edit....

Delphi-Quellcode:
var
   window: hwnd;

window:=findwindow('IEFrame',nil);
Wie bekomme ich das hin...

s-off 2. Mai 2008 12:10

Re: SetText: Addresszeile IE
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

da IEFrame nicht Parent von dem Edit ist, reicht das leider nicht.

Du musst Dich quasi über alle Child-Elemente durchhangeln, bis Du bei Deinem Edit angelangt bist.

DeddyH 2. Mai 2008 12:16

Re: SetText: Addresszeile IE
 
Ich habe auch gerade mal WinSpy bemüht ;)
Delphi-Quellcode:
const URL = 'http://www.delphipraxis.net';
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('IEFrame',nil);
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'WorkerW', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ReBarWindow32', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Address Band Root', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ComboBoxEx32', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ComboBox', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Edit', nil);
    if wndChild <> 0 then
    begin
      SendMessage(wndChild,WM_SETTEXT,0,LongInt(PChar(URL)));
    end;
  end;
end;

s-off 2. Mai 2008 12:20

Re: SetText: Addresszeile IE
 
Zitat:

Zitat von DeddyH
wndChild := FindWindowEx(wndChild, 0, 'Address Band Root', nil);

Hast Du IE7?
Bekomme ich unter IE6 nämlich nicht.

DeddyH 2. Mai 2008 12:22

Re: SetText: Addresszeile IE
 
Jepp, ist der 7er (obwohl ich den so gut wie nie benutze).

Xzeer 2. Mai 2008 12:25

Re: SetText: Addresszeile IE
 
thx für die antoworten.

Ich hab selbst ja auch WinSpy benutzt, aber auf die Idee mir den Code generieren zu lassen bin ich dann doch nicht gekommen. :wall:

Ist wohl noch zu früh :wink:

toms 2. Mai 2008 14:05

Re: SetText: Addresszeile IE
 
Beim IE8 siehts wieder anders aus:

Delphi-Quellcode:
var
  wndMain, wndChild: HWND;
begin
  wndMain := FindWindow('IEFrame', nil);
  if wndMain <> 0 then
  begin
    wndChild := FindWindowEx(wndMain, 0, 'WorkerW', nil);
    wndChild := FindWindowEx(wndChild, 0, 'ReBarWindow32', nil);
    wndChild := FindWindowEx(wndChild, 0, 'Address Band Root', nil);
    wndChild := FindWindowEx(wndChild, 0, 'AddressDisplay Control', nil);
    if wndMain <> 0 then
    begin

    end;
  end;
end;
Zitat:

Zitat von Leos-Studio
Ich versuche mit Hilfe eines Handels die Addresszeile vom Internet Explorer zu verändern. Aber irgendwie gelint es mir nicht das Handel zu finden.

Du kannst auch IWebBrowser2 ermitteln und dann zu einer anderen URL navigieren.
Oder was möchtest du damit genau erreichen?


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz