?
Solved

get IE link

Posted on 2001-08-01
7
Medium Priority
?
235 Views
Last Modified: 2010-04-06
I want a text box in my application to be able to receive IE links and display it's text and url.
is there any way to do this?

thanks
0
Comment
Question by:pin_plunder
[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
7 Comments
 
LVL 15

Expert Comment

by:simonet
ID: 6343367
What do you mean by IE links? URLs?

Alex
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 800 total points
ID: 6343747
Hello

simonet, where have you been, I didn't see your comments form long time.

pin_plunder, This code will give you all the links in the address bar from ie in memo box, even if you have more than one ie window open

//===========
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

//Copy the text from the IE Address Bar Edit box.
function GetIEEditText(wnd: THandle; Param: Integer): Bool; stdcall;
var
  wndClass: array[0..127] of char;
begin
  //Get the object class name.
  GetClassName(wnd, wndClass, SizeOf(wndClass));
  //Is the desired object?
  if wndClass = 'Edit' then
  begin
    SendMessage(wnd, EM_SETSEL, 0, -1); //Select the whole text.
    SendMessage(wnd, WM_COPY, 0, 0);    //Copy it to the ClipBoard.
    SendMessage(Param, WM_PASTE, 0, 0); //Paste from the ClipBoard to the Memo1.
    SendMessage(Param, WM_CHAR, 13, 0); //Send ENTER to the Memo1.
    Result := False;                    //Stop searching.
  end else
    Result := True;                     //Continue searching.
end;

//Searches the ComboBox where the edit box is on.
function GetIEAddres(wnd: THandle; Param: Integer): Bool; stdcall;
var
  wndClass: array[0..127] of char;
begin
  //Get the object class name.
  GetClassName(wnd, wndClass, SizeOf(wndClass));
  //Is the desired object?
  if wndClass = 'ComboBoxEx32' then
  begin
    EnumChildWindows(wnd, @GetIEEditText, Param); //Enum the child objects.
    Result := False;                              //Stop searching.
  end else
    Result := True;                               //Continue searching.
end;

//Searchs the Internet Explorer.
function FindIExplorer(wnd: THandle; Param: Integer): Bool; stdcall;
var
  wndClass: array[0..127] of char;
begin
  //Get the object class name.
  GetClassName(wnd, wndClass, SizeOf(wndClass));
  //Is the Internet Explorer main form?
  if wndClass = 'IEFrame' then
    EnumChildWindows(wnd, @GetIEAddres, Param); //Enum the child objects.
  Result := True; //Continue searching other IExplorer windows.                      
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  //Enum all the Windows's windows. The LParam is the memo's handle.
  EnumWindows(@FindIExplorer, Memo1.Handle);
end;

end.

Best regards
Mohammed Nasman
0
 

Expert Comment

by:BryGuy
ID: 6345330
You can also use DDE:

var
  IeClient : TDdeClientConv;
  p : PChar;
begin
  IeClient := TDdeClientConv.Create (nil);
  try
    with IeClient do
    begin
      SetLink ('IEXPLORE', 'WWW_GetWindowInfo');
      p := RequestData ('0xFFFFFFFF');
      // p is your URL, etc.... do whatever you want with it...
      StrDispose (p);
      CloseLink;
    end;
  finally
    IeClient.Free;
  end;
end;
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:pin_plunder
ID: 6345779
mnasman your code worked all right, but I've got some simple questions about it:
1) how do you know the Internet Explorer Class is called "IEFrame"
2) how can I do the same with Netscape

the points are already yours but first please explain me these things.

many thanks.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6347712
Hello pin_plunder

  for the first question, if you are run winsight that come with delphi, it will show u all the running processes, and you will find that the IE have the class {IEFrame}, so from there you can know these things.

for second question, Honestly I havn't tried that with netscape, I havn't used it from long time, but if I have a free time, I will install it and try that

Mohammed
0
 

Author Comment

by:pin_plunder
ID: 6350355
thank you. ahh!, thanks to your last comments it was possible to me to do the same with netscape.
THANKS.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6350975
That's great, you are welcome any time :o)
Mohammed
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 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