Solved

get IE link

Posted on 2001-08-01
7
215 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree compare node issue 14 105
Delphi Form ownership 4 73
Create a path if not exists 7 69
Multi-layered image in FireMonkey 9 15
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now