Solved

get IE link

Posted on 2001-08-01
7
225 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
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 200 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
Technology Partners: 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!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 358
how to center only a line in richedit? 4 69
delphi parse string to params 3 156
Problem working with dynamic array - help 2 36
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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