Duvida Sobre Internet Explorer

Delphi

20/05/2005

Boa noite, tenho esse codigo
function GetUrlFromIE (Handle: THandle; List: TStringList):
 boolean; stdcall;
var
  hWndIE, hWndIEChild : HWND;
  Buffer : array[0..255] of Char;
begin
  //get the window caption
  SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0]));
  //look for the Internet Explorer window with "Buffer" caption
  hWndIE := FindWindow(´IEFrame´, Buffer);
  if hWndIE > 0 then
begin
    //try to get a handle to IE´s toolbar container
    hWndIEChild := FindWindowEx(hWndIE, 0, ´WorkerW´, nil);
    if hWndIEChild > 0 then
    begin
      //get a handle to address bar
      hWndIEChild := FindWindowEx(hWndIEChild, 0, ´ReBarWindow32´, nil);
      if hWndIEChild > 0 then
      begin
        //finally, locate combo box and add its text to the list
        hWndIEChild := FindWindowEx(hWndIEChild, 0, ´ComboBoxEx32´, nil);
        if hWndIEChild > 0 then
        begin
          SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
          //List.AddObject(Buffer,TObject(hWndIE));
          List.Add(Buffer)
        end;
      end;
    end;
  end;
  //continue enumeration
  Result :=True;
end; (*GetUrlFromIE*)

procedure TForm1.btnRefreshClick(Sender: TObject);
begin
  lbIEURL.Clear;
  EnumWindows(@GetUrlFromIE, LParam(lbIEURL.Items));
end;


Esse codigo está funcionando corretamente, ele verifica todos os IEs abertos e captura as URLs e joga uma listbox, mas gostaria de saber como faço pra comparar a URL do IE com o banco de dados de URL proibidas para serem acessadas, caso esteja cadastrada no BD retorne um aviso e não exiba a página. Mas gostaria que funcionasse para todos os Browsers existentes hj.

Desde já obrigado


Facc

Facc

Curtidas 0

Respostas

Michael

Michael

20/05/2005

Olá amigo!

A melhor forma de se fazer isso é ´hookar´ as funções da API do Windows responsáveis por abrir os sites na Internet. Desta forma, vc vai conseguir monitorar qualquer aplicação q tentar abrir web-sites.

Veja este tópico: http://forum.clubedelphi.net/viewtopic.php?t=63260.

[]´s


GOSTEI 0
POSTAR