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
PeterdeBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.