[yunqa.de] url redirect on ie7

  • From: Andre Bernades Rocha <andreprogrocha@xxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sun, 14 Mar 2010 05:24:49 -0700 (PDT)

Hi people, I have the following code it works in IE8 but I can not do work in 
ie7 
someone has a suggestion?

unit blockedsite;
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;
implementation
{$R *.dfm}
procedure SetUrlFromIE(Handle: THandle; Url: string); stdcall;
var
  hWndIE, hWndIEChild : HWND;
  Buffer : array[0..255] of Char;
  ie8log : integer;
//  Url: String;
begin
   ie8log := 0;
 
   SendMessage(Handle, WM_GETTEXT, 1023, integer(@Buffer[0]));
  hWndIE := FindWindow('IEFrame', Buffer);
  If hWndIE > 0 Then
    Begin
 
      hWndIEChild:= FindWindowEx(hWndIE, 0, 'WorkerW', nil);
      If hWndIEChild > 0 Then
        Begin
     
          hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
              If hWndIEChild > 0 Then
            Begin
        
              hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
              If hWndIEChild > 0 Then
                Begin
           
                  hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBox', nil);
                  If hWndIEChild > 0 Then
                    Begin
                  
                      hWndIEChild := FindWindowEx(hWndIEChild, 0, 'Edit', nil);
                      If hWndIEChild > 0 Then
                        Begin
                      
                          SendMessage(hWndIEChild, WM_SETTEXT,  0, lParam(Url));
                   
                          PostMessage(hWndIEChild, WM_KEYDOWN,  $D, $0008044C);
                        End; 
                    end; 
                end; 
            end; 
        end; 
    end 
 else
         begin
            hWndIE:=FindWindow('IEFrame', Nil );
        if hWndIE > 0 then
         begin
         hWndIEChild:=FindWindowEx(hWndIE, 0, 'WorkerW', nil);
         if (hWndIEChild > 0)  and  (ie8log=0) then
          begin
  hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
  hWndIEChild := FindWindowEx(hWndIEChild, 0, 'Address Band Root',nil);
  hWndIEChild := FindWindowEx(hWndIEChild, 0, 'edit',nil);

          { if hWndIEChild > 0 then
               begin
            hWndIEChild:=FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
          if hWndIEChild > 0 then
                            begin
        hWndIEChild:=FindWindowEx(hWndIEChild, 0, 'Address Band Root', nil);    
}
       {    if hWndIEChild > 0 then
                                begin
           hWndIEChild:=FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil); }
   {            If hWndIEChild > 0 Then
                    Begin
                      // Pega o Handle do Edit do Internet Explorer
                      hWndIEChild := FindWindowEx(hWndIEChild, 0, 'Edit', nil);
                      If hWndIEChild > 0 Then
                        Begin }
                       
                          SendMessage(hWndIEChild, WM_SETTEXT,  0, 
integer(Url));
                       
                          PostMessage(hWndIEChild, WM_KEYDOWN,  $D, $0008044C);
  {end;
  end;
  end; }
  end;
 { end;}
  end;
  end;
    end;
 
procedure TForm1.Timer1Timer(Sender: TObject);
var Janela : THandle;
    Janela2 : THandle;
begin

 Janela := FindWindow(nil, 'Porno - Windows Internet Explorer');
  if Janela > 0 then
  begin
   SetUrlFromIE(Janela,'http://www.mysite.com/blockedsite.htm');
  end;
 
end;
end.


      

Other related posts:

  • » [yunqa.de] url redirect on ie7 - Andre Bernades Rocha