[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

How to copy the URL in the IE Address bar into an Tedit on my form?

Hi guys!

The title is quite selfexplanatory I guess. Just want to copy the URL in the IE Address bar into a TEdit on my form preferrably by a button click. Further more I want to grab text from a webpage which I normally can only view by right clicking > view source. How can I grab that text and put it into a TMemo on my form?

Two questions therefore I double the reward for working samples on both!

Regards from Holland,

Let me know if any info is missing ok?

PeterdeB
0
PeterdeB
Asked:
PeterdeB
  • 6
1 Solution
 
ginsonicCommented:
Read more at : http://www.euromind.com/iedelphi/ie5tools/ieautomate.htm
uses
  shdocvw_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
  x: Integer;
  Sw: IShellWindows;
begin
  sw := CoShellWindows.Create;
  for x := 0 to SW.Count - 1 do
    Listbox1.Items.Add((Sw.Item(x) as IWebbrowser2).LocationUrl);
end;
0
 
ginsonicCommented:
Exactly an answer for you ( BTW work perfect ):

uses
  shdocvw_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
  Sw: IShellWindows;
begin
  sw := CoShellWindows.Create;
  Edit1.Text:=(Sw.Item(0) as IWebbrowser2).LocationUrl;  // replace 0 with your IE instance order number ..1..2..3..4..etc
end;
0
 
ginsonicCommented:
...get the HTML Code out of all Internet Explorer Instances?

http://www.swissdelphicenter.ch/en/printcode.php?id=1615
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ginsonicCommented:
Attention! you get the document source ( the HTML ) and not displayed text. Your Memo can't read the code as a browser. If you wish to diplay as IE then use a TWebBrowser or better EnbeddedWB from my first link.
0
 
ginsonicCommented:
0
 
PeterdeBAuthor Commented:
Splendid ginsonic!!!

Regards from Holland,

PeterdeB
0
 
ginsonicCommented:
Glad to can help :)

Regards from Romania,
Nick aka ginsonic
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now