Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 07-03-2011
razonasistemas razonasistemas is offline
Registrado
NULL
 
Registrado: feb 2011
Ubicación: Oviedo, España
Posts: 5
Poder: 0
razonasistemas Va por buen camino
Esto vale solo para algunos navegadores

Hola:

Este codigo vale solo para algunos navegadores :

Código Delphi [-]
uses ddeMan;

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;

Yo lo he intentado, pero no me funciona con el Chrome, pero si con el IE.
Responder Con Cita
  #2  
Antiguo 08-03-2011
FENIXadr FENIXadr is offline
Miembro
 
Registrado: may 2010
Ubicación: Córdoba - Cba. - Argentina
Posts: 104
Poder: 15
FENIXadr Va por buen camino
Thumbs up

SIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII....... razonasistemas sos un genioooooo... es justamente lo que necesitaba... muchísimas graciass...

Este hilo se puede dar por terminado...

Una vez más muchisisisisisimas gracias razonasistemas..
Responder Con Cita
  #3  
Antiguo 09-03-2011
Avatar de rgstuamigo
rgstuamigo rgstuamigo is offline
Miembro
 
Registrado: jul 2008
Ubicación: Santa Cruz de la Sierra-Bolivia
Posts: 1.646
Poder: 17
rgstuamigo Va por buen camino
Arrow

Cita:
Empezado por razonasistemas Ver Mensaje
Hola:

Este codigo vale solo para algunos navegadores :

Código Delphi [-]
uses ddeMan;

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;

Yo lo he intentado, pero no me funciona con el Chrome, pero si con el IE.
Muy interresante código amigo razonasistemas... nada más que al ejecutar varias veces el procedimiento "GetCurrentURL" estamos haciendo mal uso de la memoria, ya que el objeto "DDEClient" no se está liberando por lo cual deberiamos agregar una linea más para que tal objeto se destruya y libere su memoria que ocupa...
Saludos...
__________________
"Pedid, y se os dará; buscad, y hallaréis; llamad, y se os abrirá." Mt.7:7
Responder Con Cita
  #4  
Antiguo 09-03-2011
FENIXadr FENIXadr is offline
Miembro
 
Registrado: may 2010
Ubicación: Córdoba - Cba. - Argentina
Posts: 104
Poder: 15
FENIXadr Va por buen camino
SI SI... muy buen aporte rgstuamigo... se puede hacer de muchas maneras.... en mi caso creo DDEClient en el evento "OnCreate" del Form y lo destruyo en el evento "OnClose".. solo por hacerlo una vez y no cada vez que se llama a "GetCurrentURL".
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Como averiguar si una unit o datamodule ya está abierto jjoliveras OOP 2 20-06-2007 11:28:56
Averiguar si está instalado WINZIP en un PC Jose Manuel Varios 4 07-11-2006 12:54:40
¿Cómo puedo averiguar las URLs por las que está navegando el usuario? marceloalegre Varios 8 11-08-2006 15:56:20
Como averiguar que ventana de windows esta activa? JuanErasmo API de Windows 5 17-04-2006 21:47:40
Averiguar si la combinación de dos campos está en uso DarkByte Conexión con bases de datos 18 28-09-2004 16:59:04


La franja horaria es GMT +2. Ahora son las 19:55:56.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi