catches IE Events

Hi,

i am writing an extension for internet explorer

i have already created the extension

however i need to catch IE events like "NavigateComplete"

is there anyway to catch the events using visual c#

thanks

Regards

Roy



Answer this question

catches IE Events

  • yadgor2000

    Ya I am using ...
    Anyway, in SHDocVw there is a method which i can use.Anyway, thanks a lot for the help given.

    Regards
    Roy

  • Shocky

    Hi,

    may i know what and where can i find the BandObject

    thanks in advance



  • MLyons10

    If using BandObject...all you need for any event:

    Explorer.NavigateComplete += new SHDocVw.DWebBrowserEvents_NavigateCompleteEventHandler(Explorer_NavigateComplete);



  • Steve Olson

    Are you using BandObject from codeproject

  • NetPochi

    Thanks cablehead

    I actually looking something similiar, and tried this code:

    private BandObject BO = new BandObject();
    private WebBrowserClass Explorer = new WebBrowserClass();

    private delegate void DWebBrowserEvents_NavigateCompleteEventHandler(string target);

    public Form1()
    {
    InitializeComponent();
    this.BO.ExplorerAttached += new EventHandler(MyBandObjectToolbar_ExplorerAttached);
    }

    private void MyBandObjectToolbar_ExplorerAttached(object sender, EventArgs e)
    {
    this.Explorer.NavigateComplete += new SHDocVw.DWebBrowserEvents_NavigateCompleteEventHandler(Explorer_NavigateComplete);
    }

    public void Explorer_NavigateComplete(string target)
    {
    string m_Url = "C:/NaN.html";
    object m_Flag = null;
    object m_Frame = null;
    object m_Postdata = null;
    object m_Headers = null;
    if (target == "http://www.google.com")
    {
    Explorer.Navigate(m_Url,
    ref m_Flag, ref m_Frame, ref m_Postdata, ref m_Headers);
    }
    }

    As you can see, actually i would like to use this library to detect the navigation event of browser, and redirect the page to other path (local path). It is used to restrict some sites. I know the last part is kinda stupid, however i have not be able to research it yet coz when i tried to visit a website using IE6 browser, the event didn't even invoked.

    Anything that i had missed out



  • An De Lafonteyne

    Hi, i really still don't how and where or whether my implementation is correct or not. Everytime try to debug, can never get it right. However i give my skeleton code. Can someone pointing where and how should i implement it

    Below is my code skeleton:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Windows.Forms;
    using BandObjectLib;
    using SHDocVw;

    namespace message
    {
    public partial class Form1 : Form
    {
    private BandObject BO = new BandObject();
    private WebBrowserClass Explorer = new WebBrowserClass();

    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
    BO.ExplorerAttached +=
    new EventHandler(ExplorerAttached);
    }

    private void ExplorerAttached(object sender, EventArgs e)
    {
    Explorer.NavigateComplete +=
    new SHDocVw.DWebBrowserEvents_NavigateCompleteEventHandler(NavigateComplete);
    }

    public void NavigateComplete(string target)
    {
    Debug.WriteLine(target);
    }
    }
    }

    Did i miss any codes, registering the registry, or what i really don't understand. the Event just won't invoke at all. I bet i have implement this wrongly. Pls... can anyone solve it for me... i need it urgently.. i have overdue my deadline just for this function to be done....

    Thanks



  • Joe H

    Yes you can use it.

    BeforeNavigate....get the URL and Cancel = true.

    Then re-navigate to the desired page.



  • carrera7

    hi, i did it after almost a week strugelling.

    the toolbar and the blocking, navigating can work.

    However i found that it will only work after i select the toolbar at view menu. And i need to enable it in IE add-ons menu.
    How may i change the implementation to:
    1. auto add-on and enable in IE
    2. not a toolbar but as a BHO will do

    thanks



  • Deva Wijewickrema

  • CIAndrew

    I tried the DocumentConplete

    and retry to navigate by pressing Go button, Back, retype same url, retype different url, no hope.



  • moemoe

    I tried BandObjectLib. I import the project into my windows application project.

    On the other project (windows application) but still under same solution, I create the object based on this BandObjectLib. and register some of its event respectively.

    But when i tried to debug, the event won't fired.

    Is it because i haven't add the BandObjectLib's dll to IE All the way i thought is that whenever i create its object, it will self-register.

    if that is the case, how am i going to add the dll using my windows application. so that the event will fired.

    Can anyone explain to me how this things is working, any procedure, rules regulation that i need to follow, before.... i can try using my windows application to catch IE events



  • Mar_GP

    http://support.microsoft.com/kb/269614

    it is actually a bug, i suppose quite a number of events arent called at the first navigation.
    A way to test it out is after open IE, try to enter a url see whether the events catches then ...enter a URL again...and see if the event catches again.

    well..last time i did have this problem the solution i did was actually simulate a second naviagtion as a first navigation.

  • btravis

    Try Explorer.DocumentCompelte....just to see if your code works. I know that event fires using the bandobject.

  • SkiesOfBordom

    Or can i use this library to do the website blocking in the first place



  • catches IE Events