• Breaking News

    Panduan dan Tutorial Lengkap serta Materi Pelajaran di Mulyono Blog. Konten Terlengkap dan Terpercaya

    Selasa, 20 September 2011

    Mengetahui URL dari Browser dengan delphi

    unit Unit1;

    interface

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

    type
    TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.DFM}

    uses ddeman;

    procedure TForm1.Button1Click(Sender: TObject);
    const
    sName = 'Name';
    sURL = 'URL';
    var
    DDEClient : TDDEClientConv;
    s : string;
    begin
    s := '';
    try
    DDEClient := TDDEClientConv.Create(self);
    try
    with DDEClient do
    begin
    if SetLink('IExplore','WWW_GetWindowInfo') then
    s := RequestData('0xFFFFFFFF,sURL,sTitle')
    else
    if SetLink('Netscape','WWW_GetWindowInfo') then
    s := RequestData('0xFFFFFFFF,sURL,sTitle')
    else
    if SetLink('Mosaic','WWW_GetWindowInfo') then
    s := RequestData('0xFFFFFFFF,sURL,sTitle')
    else
    if SetLink('Netscp6','WWW_GetWindowInfo') then
    s := RequestData('0xFFFFFFFF,sURL,sTitle')
    else
    if SetLink('Mozilla','WWW_GetWindowInfo') then
    s := RequestData('0xFFFFFFFF,sURL,sTitle');
    end;
    finally
    Edit1.Text := s;
    DDEClient.Free;
    end;
    except
    end;
    end;

    end.