Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9177399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:19:05+00:00 2026-06-17T17:19:05+00:00

I am working on a Browser Helper Object in C# (yes I know performance

  • 0

I am working on a Browser Helper Object in C# (yes I know performance will not be great).

I am attaching a handler to the HTMLWindowEvents2_Event.onload event of my window. The event is being raised correctly (for example when a refresh happens). I see my handler being called, and the type is correctly shows as a ‘load’ event.

The event handler has a parameter that supports the IHTMLEventObj. I cannot work out how to get from this object to the window or document that threw the onload event. Is this even possible from this interface? The object passed into appears to have a null srcElement property (presumably as it is an event raised by the window, not some element in the document).

Do I need to cast this into another class or interface to get at the document?

I would be happy for any help in C# or C++.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:19:06+00:00Added an answer on June 17, 2026 at 5:19 pm

    There is no source information for the event.

    The assumption is that since you attached the event to the connection point of the Window object, you knew which window would be the event source. When you hook the event you need to save the reference to the window in case you need the event source.

    Class HTMLWindowEvents2Sink
    {
        public HTMLWindowEvents2Sink(IHTMLWindow2 eventSource)
        {
            this.eventSource=eventSource;
        }
        IHTMLWindow2 eventSource;
        void AdviseEvent()
        {
            eventSource.load += this.HTMLWindow_onload; 
        }
        ....
    }
    

    You also have a performance hit and potential bug farm here, by using the delegate event handling model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working Browser Helper Object (BHO) which is essentially an ATL based
I'm trying to write a cross-browser event addition method but it's not working in
IE9 users can disable an add-on, such as a browser helper object, by clicking
I am working on a Browser-based media player which is written almost entirely in
I'm working on a browser-game and I can't help but wonder about what's the
Following Script isn't working in CHROME browser, IE is Fine. I've changed opener.document ...
I am trying to get out of browser support working for my Silverlight application
Working on a script to collect users browser history with time stamps ( educational
I'm working on a Blackberry 5.2 browser app. I have some JavaScriptthat returns some
I'm working on a server in a distributed application that has browser clients and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.