Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading the ie addressline content from a second program

Posted on 2004-03-26
8
Medium Priority
?
196 Views
Last Modified: 2011-09-20
Hello !
I'm working with delphi 5 and Win98/XP.
Is it possible to read the actual content of browser address-lines (netscape and ie) from a second program (my delphi app) running in the background when doing a button-click there?
If someone have a few code lines or a link for additional help for me i'll be very happy!
Thanks a lot!
Best regards,
Ingo
0
Comment
Question by:Ogni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10689945
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10689968

The link i provided, should do it for you, but you can also check out this site:

http://www.euromind.com/iedelphi/index.htm

for other IE related issues:

Shane
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 400 total points
ID: 10690938
I tested this with IE and it works, I don't have NS installed but this should work for it as well.

// For IE:
procedure GetIEInfo(var sURL: String; var sTitle: String);
var
  DDE:TDDEClientConv;
  sInfo: String;
  slInfo: TStringList;
begin
  slInfo := TStringList.Create;
  try
    DDE:=TDDEClientConv.Create(nil);
    try
      if DDE.SetLink('IExplore','WWW_GetWindowInfo') then
        slInfo.CommaText := DDE.RequestData('0xFFFFFFFF');
    finally
      DDE.Free;
    end;
  finally
    sURL := slInfo[0];
    sTitle := slInfo[1];
    slInfo.Free;
  end;
end;

//For Netscape:
procedure GetNetscapeInfo(var sURL: String; var sTitle: String);
var
  DDE:TDDEClientConv;
  sInfo: String;
  slInfo: TStringList;
begin
  slInfo := TStringList.Create;
  try
    DDE:=TDDEClientConv.Create(nil);
    try
      if DDE.SetLink('Netscape','WWW_GetWindowInfo') then
        slInfo.CommaText := DDE.RequestData('0xFFFFFFFF');
    finally
      DDE.Free;
    end;
  finally
    sURL := slInfo[0];
    sTitle := slInfo[1];
    slInfo.Free;
  end;
end;

//Usage:
procedure TForm1.Button1Click(Sender: TObject);
var
  sURL, sTitle: String;
begin
  GetIEInfo(sURL, sTitle);
  Memo1.Lines.Clear;
  Memo1.Lines.Add(sURL);
  Memo1.Lines.Add(sTitle);
  GetNetscapeInfo(sURL, sTitle);
end;
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.

 
LVL 26

Expert Comment

by:EddieShipman
ID: 10690944
Oh,

uses ..., DDEMan;
0
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 400 total points
ID: 10691058
This code will retrieve the address from ALL IE instances (more than one IE open)

place a button and listbox on your form


function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
begin
    //try to get a handle to IE's toolbar container
    hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil);
    if hWndIEChild > 0 then
    begin
      //get a handle to address bar
      hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
      if hWndIEChild > 0 then
      begin
        //finally, locate combo box and add its text to the list
        hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
        if hWndIEChild > 0 then
        begin
          SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
          //List.AddObject(Buffer,TObject(hWndIE));
          List.Add(Buffer)
        end;
      end;
    end;
  end;
  //continue enumeration
  Result :=True;
end; (*GetUrlFromIE*)


procedure TForm1.btnRefreshClick(Sender: TObject);
begin
 listbox1.Clear;
 EnumWindows(@GetUrlFromIE, LParam(listbox1.Items));
end;


Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10691076
The GetUrlFromIE function is declared in the interface section as
 
function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
 
This function is an application-defined callback function that receives top-level window handles as a result of a call to the EnumWindows.

Again, this is all laid out in a very nice example here:
http://delphi.about.com/library/weekly/aa060303a.htm

Shane
0
 

Author Comment

by:Ogni
ID: 10698138
Hi Eddie, hi Shane,

Thanks a lot for your help!!!
I think splitting the points is fair.

Best regards,
Ingo
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 10698558
You did say from both NS and IE, right?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question