Главная страница | назад





Article #21516: How to capture the URL and title of the current webpage being viewed.

Question:
How can I see if Netscape is running and capture the current URL?

Answer:
This code sample will allow you to see if Netscape is running. Also, it will put the URL and page title into one string. This code will also work for IExplorer. Just replace the Netscape with IExplorer. Place a TEdit component on the form, to view the current URL and page title.

Uses
DdeMan;
procedure TForm1.Button1Click(Sender: TObject);
var
DDE: TDdeClientConv;
begin
DDE := TDdeClientConv.Create(self);
if DDE.SetLink( 'Netscape', 'WWW_GetWindowInfo' ) then
Edit1.Text := DDE.RequestData( '0xFFFFFFFF, sURL, sTitle' )
else
ShowMessage( 'Netscape is not running' );
DDE.Free;
end;

Last Modified: 05-APR-00