bho

Handle HTMLElementEvents2 when DWebBrowserEvents2 has been handled using ATL's macros

人走茶凉 提交于 2019-12-06 14:15:49
问题 I'm creating a Browser Helper Object using VS2008, C++. My class has been derived from IDispEventImpl among many others class ATL_NO_VTABLE CHelloWorldBHO : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CHelloWorldBHO, &CLSID_HelloWorldBHO>, public IObjectWithSiteImpl<CHelloWorldBHO>, public IDispatchImpl<IHelloWorldBHO, &IID_IHelloWorldBHO, &LIBID_HelloWorldLib, /*wMajor =*/ 1, /*wMinor =*/ 0>, public IDispEventImpl<1, CHelloWorldBHO, &DIID_DWebBrowserEvents2, &LIBID

BHO for capturing user clicks works fine in Windows other than Windows 7 Home Premium with IE9

自作多情 提交于 2019-12-06 14:09:50
问题 I have written a BHO for IE 8 and IE9 that binds and capture certain elements(e.g INPUT element) from a user's page on my website and instead of performing the click event, performs custom post processing and presents user with different options based the data attached to each div/input element on which user has clicked. Now the problem is: it works fine in the following configurations: Windows XP , IE 8 working Windows 7 Ultimate x86 , IE 8 - working Windows 7 Ultimate x64 , IE 8 - working

BHO exposing javascript method works in IE 9+ but fails in earlier versions

空扰寡人 提交于 2019-12-06 13:03:12
I'm making a BHO that exposes method to JavaScript. It works okey in IE 9 and IE 10, but fails in IE 8 with RuntimeBinderException : "mshtml.HTMLWindow2Class" does not contain "signJson" . Code is mostly based on live reload IE extention . Here is a way that function is injected into window: public void InjectScriptResource(dynamic window) { var windowEx = (IExpando)window; if (windowEx.GetProperty("signJson", BindingFlags.Default) == null) { windowEx.AddProperty("signJson"); window.signJson = this; } } What's different about about mshtml.HTMLWindow2Class in IE 8 from IE 9? What is a proper

Want to enable BHO in a WebBrowser Control embedded in a standard C# App

老子叫甜甜 提交于 2019-12-06 08:05:11
问题 I have a standard winforms C# app with a webbrowser control dragged onto it. We also have a C++ BHO that we generally interact with through COM when it runs inside IE7 or IE8. I don't see any way to tell the webbrowser control to load the BHO. The BHO doesn't show any GUI or anything, it just listens to the http traffic when used from IE. Any help would be greatly appreciated. Thanks. 回答1: BHOs are just COM objects who implement IObjectWithSite. You can just create a instance of your BHO,

DocumentComplete is firing before page is fully loaded

血红的双手。 提交于 2019-12-06 04:17:29
Why does DocumentComplete event of WebBrowser COM object fire before page is loaded? I thought that this event is only fired when page is fully rendered in browser's window. this is my BHO implementation: [ComVisible(true), Guid("5a954357-44bd-4660-9570-17bb1b71eeaa"), ClassInterface(ClassInterfaceType.None)] public class BHO : IObjectWithSite { private WebBrowser browser; private DateTime startTime; private DateTime endTime; private object _pUnkSite; public void OnDocumentComplete(object pDisp, ref object URL) { if (!ReferenceEquals(pDisp, _pUnkSite)) { return; } using (StreamWriter sw = File

Detect Page Refresh in BHO

空扰寡人 提交于 2019-12-06 03:36:40
IE doesn't fire DocumentComplete & NavigateComplete2 events after a page refresh (F5). This is apparently "by design", but it makes it hard to respond to a page reload. What approaches out there have had the best success? What are the caveats? Thx There is no direct method and it is hard to implement across different versions of IE. Although you can use combination of some events to achieve that. Be warned the following approaches are not fool proof. Links: MSDN Forum Detecting the IE Refresh button Refresh and DISPID_DOCUMENTCOMPLETE 来源: https://stackoverflow.com/questions/8555627/detect-page

How can i set the name of IE Extension (BHO In IE)

混江龙づ霸主 提交于 2019-12-06 02:20:23
How Can i Set the Name of the BHO appear in IE Extension (e.g Manage Addons).. The Name that Appear in the Internet Explorer Addons list is the Namespace of my program when i attach it with regasm.exe. how can i set the name of that.?... Thanks. I am working on a C# BHO, and was struggling with this very same question. If you're working with C#, one approach that can be taken is to add code similar to the following in the method that is marked with the ComRegisterFunction attribute. This will set the appropriate registry key value so that the name that you desire will be reflected in the

How to debug a managed BHO from Visual Studio 2010

青春壹個敷衍的年華 提交于 2019-12-06 01:59:51
问题 I've a managed Explorer Bar (working in Internet Explorer) that is working reasonably well. Currently, the only way to debug it: Start IE outside VS From VS (Debug => Attach) Attach to the process "iexplore.exe" Trying to do the following: Go to Project Properties => Debug tab Start External Program: c:\program files (x86)\internet explorer\iexplore.exe Command line argument: about:blank Hit F5 The first method is very cumbersome. With the second method, iexplore starts, but the debugger

Finding the offset client position of an element

痞子三分冷 提交于 2019-12-05 23:30:10
How to find the offset client position of an element using Javascript? (I assume the same code can be written in a BHO or Gecko/NPAPI). The problem I am facing is a way to find out the offset client position of the element. The e.srcElement.offsetX/Y does not give the correct value always (same goes for clientX/Y). In some cases we also need to consider the parent element scroll. How do we do this in general? Is there an easy way for this? function getElementTop ( Elem ) { var elem; if ( document.getElementById ) { elem = document.getElementById ( Elem ); } else if ( document.all ) { elem =

How to embed an image on a web page from a BHO?

柔情痞子 提交于 2019-12-05 18:59:28
I have a BHO library mybho.dll written in C#. I have embedded a Resource file "image.png". I'd like to show this image on some pages. According to what I read, it should look like this: <img src="res://mybho.dll/image.png"> But Internet Explorer does not find the image. I've tried this one without success: <img src="res://mybho.dll/#2/image.png"> What is the right way to do it? You are confusing Win32 resources and .NET assembly resources. the 'res:' protocol handler returns a Win32 resource from a DLL. .NET resources are NOT Win32 resources, and as such IE (Actually urlmon.dll, where res: is