bho

c# specified cast is not valid while assigning mshtml.HTMLDocument.frames

℡╲_俬逩灬. 提交于 2019-12-11 03:34:49
问题 I'm developing an IE BHO, While accessing frames in a html document i'm getting this error Here is the code. foreach (SHDocVw.InternetExplorer objExplorer in objShellWins) { if (objExplorer.Document is HTMLDocument) { objDocument = (mshtml.HTMLDocument)objExplorer.Document; mshtml.HTMLDocument doc = (mshtml.HTMLDocument)objExplorer.Document; mshtml.FramesCollection frames = (mshtml.FramesCollection)doc.frames; //Exception at this line } } what is the issue here ? 回答1: OK people i got it

Threading in BHO/ATL/COM. Winapi or something else?

最后都变了- 提交于 2019-12-11 03:19:57
问题 I writing IE add-on and I'm using ATL for it. I need to create background worker thread so UI thread will be unblocked as soon as possible. My question is, should I use the lowest possible way of creating thread which is Winapi, CreateThread etc. Or is there other proffered way of creating worker thread in BHO/ATL/COM projects? I have to learn this stuff first so I thought I would ask first ;) 回答1: There is no need to use low-level APIs unless you need the level of control they offer. With

How to detect that an add-on has been disabled by the user in IE9?

心不动则不痛 提交于 2019-12-11 02:57:10
问题 IE9 users can disable an add-on, such as a browser helper object, by clicking on the cog button and selecting "Manage Add-Ons". I need to detect if a given add-on has been disabled in such way, using JavaScript. I can't seem to find a way for my error handler ( <object ... onerror="myhandler(event)" ) to detect that the BHO has been disabled. errorEvent.type is simply "error" . Is there any way? I need to detect this scenario because just having the webpage try to install the BHO again yields

How to get the screen coordinate of web-page elements in BHO

吃可爱长大的小学妹 提交于 2019-12-10 12:07:57
问题 I am writing a BHO object for IE. I want the screen position of the top-left of the web-page. How can i get this position? The topleft of the first element in DOM returns (0,0). The webBrowser.Left or Top returns the position of the browser but not the top-left of the page. I am using IWebBrowser2. Thanks a million, -anony. 回答1: You may have already figured this out, but using ClientToScreen function might help you. 回答2: I solved the problem myself. The IHTMLElement2.getBoundingClientRect()

Internet Explorer BHO, writing to registry and admin privileges

早过忘川 提交于 2019-12-10 11:43:22
问题 for some reasons when I try to write to registry when IE doesn't run with admin privileges, Utils::SetValueInRegistry(HKEY_CURRENT_USER,L"Software\\myApp23",L"Domain", value.c_str()); Anyone knows how to gain my BHO rights to write to registry everytime? Or maybe should I write to another section to registry that's available for writing? The information I need to store is very dynamic and used in order to communicate between tabs. Thanks. 回答1: Internet Explorer is running with Low Integrity

Should Form.ShowDialog(IWin32Window) work with any window handle?

依然范特西╮ 提交于 2019-12-10 10:52:18
问题 When using System.Windows.Forms.ShowDialog(IWin32Window) , should I be able to pass in an IWin32Window representing any window handle and have it be modal with respect to that window? As part of an Internet Explorer 7 extension I'm trying to open a window modal with respect to an Internet Explorer tab. It's not the currently selected tab, but I can get the hwnd of the tab OK. However, when I pass this to ShowDialog my Form is shown, but it's not modal with respect to anything: I can still do

Finding the offset client position of an element

余生长醉 提交于 2019-12-10 09:55:21
问题 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? 回答1: function getElementTop ( Elem ) { var elem; if (

Windows 7 does not fire DISPID_BEFORENAVIGATE2 event?

蹲街弑〆低调 提交于 2019-12-08 21:09:26
I have a BHO that is supposed to intercept the DISPID_BEFORENAVIGATE2 events when Windows Explorer is browsing the local disks. It works well in XP and Vista, but stopped working in Windows 7 RC. Turns out, Windows 7 RC stopped sending the DISPID_BEFORENAVIGATE2 events when the local folders are browsed! It does send other events to my BHO (such as DISPID_DOWNLOADBEGIN, etc.), but I need DISPID_BEFORENAVIGATE2. Can anyone confirm this and/or offer a possible workaround? Thanks! Paul Accisano Well, it's over a year late, but here's a workaround: Simply set an API hook on IShellBrowser:

Getting url and HTMl through a BHO, SetSite throws an exception

馋奶兔 提交于 2019-12-08 12:45:19
问题 I have followed the tutorial at: http://www.15seconds.com/issue/040331.htm for making a BHO, however i doesnt seem to work for me, i have the Observer code from the examble, where she creates the actual BHO, but when i try to typecast in my SetSite it stops, i suspect i get an exception. This is my sample code, just stripped it all bare, so i get a messagebox instead. [ClassInterfaceAttribute(ClassInterfaceType.None)] [GuidAttribute("0CD00297-9A19-4698-AEF1-682FBE9FE88D")] [ProgIdAttribute(

Is it possible to use a BHO (IE8) to track which links a user clicks

我是研究僧i 提交于 2019-12-08 10:41:50
问题 Reading about BHOs and I know I can see ways in which you can track a user's navigation - however - is it possible with a BHO to identify which link was clicked by a user (for instance - if two links exist on a page in which a user can click to navigate to destination a - is it possible to determine which link was actually clicked)? 回答1: You can sink the DISPID_HTMLELEMENTEVENTS2_ONCLICK event if you can get access to the elements (sometimes you don't such as elements in a frame in another