Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Função retorna erro

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Duvida Função retorna erro

    Olá minha gente,


    Com relação ao code abaixo, ele compila, mas quando é executado dá várias mensagens de erro em sequência dizendo algo com "que ainda não encontrou a url especificada".

    (List of Bounds 0)

    é mais ou menos isso que diz. Podem testar aí esse code!

    já tentei ajeitar aqui de várias formas mas acontece o mesmo. Já pra monitorar a url de outros navegadores como Firefox e IE, eu consegui fazer.

    Alguma dica quanto a monitoração pelo Chrome?

    Caso alguém saiba de outro code que capture a url ativa do Chrome e queira compartilhar, agradeço demais!

    Aguardo.

    Segue o code mencionado acima >>>

    Código:
    //-------------------------------------------------------------------------------------------------------------------------------------------------------
    
    unit Unit1;
    
    interface
    
    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ExtCtrls;
    
    type
    TForm1 = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;
    
    var
    Form1: TForm1;
    url : string;
    
    implementation
    
    {$R *.dfm}
    
    Function GetActivePageUrlFromChrome(Handle: HWnd; Param: LParam): Bool; stdcall;
    var
    List: TStrings;
    hWndChrome, hWndChromeChild: HWND;
    Buffer : array[0..255] of Char;
    begin
    asm
    nop
    end;
    List := TStrings(Param);
    //get the window caption
    SendMessage(Handle, WM_GETTEXT, Length(Buffer), integer(@Buffer[0]));
    //look for the chrome window with "Buffer" caption
    hWndChrome := FindWindow('Chrome_WidgetWin_1', Buffer);
    if hWndChrome <> 0 then
    begin
    hWndChromeChild := FindWindowEx(hWndChrome, 0, 'Chrome_OmniboxView', nil);
    if hWndChromeChild <> 0 then
    begin
    SendMessage(hWndChromeChild, WM_GETTEXT, Length(Buffer), integer(@Buffer));
    List.Add(Buffer);
    end;
    end;
    Result := True;
    
    end;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    var
    slChromeUrl : TStringList;
    begin
    asm
    nop
    end;
    slChromeUrl := TStringList.Create;
    try
    EnumWindows(@GetActivePageUrlFromChrome, LParam(slChromeUrl));
    url := slChromeUrl.Strings[0];
    if url = 'http://forum.guiadohacker.com.br' then
    begin
    {começa a fazer o desejado.}
    ShowMessage('Teste');
    end else
    if url = 'https://www.facebook.com' then
    begin
    showmessage('teste2');
    end;
    Finally
    FreeAndNil(slChromeUrl);
    end;
    end;
    
    end.
    
    //--------------------------------------------------------------------------------------------------------------------------------------------------- --
X
Working...
X