Hola foro como andan espero que bien, bueno como lo dice mi pregunta necesito obtener el texto de la pagina que esta abierta en mi navegador actual, ojo que la pagina no la tengo abierta con mi aplicación si no que esta abierta con el navegador actual como lo es mozilla, opera, iE


Con este codigo obtengo la URL de la pagina que esta abierta, esta en delphi 7 y no lo hice yo ojala que alguien me ayude a obtener no solo la url si no tambien el texto de la pagina y cargarla en un Memo

Código: Seleccionar todo

unit Unit1;
 
 interface
 
 uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, DDEman, StdCtrls;
 
 type
   TForm1 = class(TForm)
   Button1: TButton;
   Edit1: TEdit;
   Edit2: TEdit;
   procedure Button1Click(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
   procedure GetCurrentURL (var URL, Title : string);
 end;
 
 var
   Form1: TForm1;
 
 implementation
 
 {$R *.dfm}
 
 procedure TForm1.GetCurrentURL (var URL, Title : string);
 var
   DDEClient : TDDEClientConv;
   s : string;
 begin
   s := '';
   try
     DDEClient := TDDEClientConv.Create(self);
     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')
       else
       if SetLink('Firefox','WWW_GetWindowInfo') then
         s := RequestData('0xFFFFFFFF,sURL,sTitle');
     end;
     if s <> '' then
     begin
       delete(s,1,1);
       URL := copy(s,1,pos('","',s)-1);
       delete(s,1,pos('","',s)+2);
       Title := copy(s,1,pos('"',s) - 1);
     end;
     exit;
   except
     MessageDlg('URL attempt failed!',mtError,[mbOK],0);
   end;
 end;
 
 procedure TForm1.Button1Click(Sender: TObject);
 var
   URL : string;
   Title : string;
 begin
   GetCurrentURL (URL, Title);
   Edit1.Text := URL;
   Edit2.Text := Title;
 end;
 
 end.

bueno foro si la solucion no la tienen en delhpi 7 si no en otro lenguaje no importa yo me adapto al lenguaje en que lo pongan
hola dapimp gracias por responder, bueno parece que no me ice entender yo no quiero el titulo de la ventana, yo quiero copiar el texto de la pagina que el usuario tiene abierta en ese momento, copiarlo en un memo de mi aplicacion saludos pues
Responder

Volver a “Delphi”