How can I fix "The Breakpoint will not currently be hit......"
-
Hello everyone, I am working on a Browser Helper Object (BHO) and have created a Class Library with the following code.
using System; using System.Collections.Generic; using System.Text; using SHDocVw; using mshtml; using System.IO; using Microsoft.Win32; using System.Runtime.InteropServices; namespace WebWatcher { [ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")] public interface IObjectWithSite { [PreserveSig] int SetSite([MarshalAs(UnmanagedType.IUnknown)]object site); [PreserveSig] int GetSite(ref Guid guid, out IntPtr ppvSite); } [ ComVisible(true), Guid("8a194578-81ea-4850-9911-13ba2d71efbd"), ClassInterface(ClassInterfaceType.None) ] public class BHO : IObjectWithSite { WebBrowser webBrowser; HTMLDocument document; public void OnDocumentComplete(object pDisp, ref object URL) { document = (HTMLDocument)webBrowser.Document; foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT")) { System.Windows.Forms.MessageBox.Show(tempElement.name != null ? tempElement.name : "it sucks, no name, try id" + ((IHTMLElement)tempElement).id); } } public void OnBeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) { document = (HTMLDocument)webBrowser.Document; foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT")) { if (tempElement.type.ToLower() == "password") { System.Windows.Forms.MessageBox.Show(tempElement.value); } } } #region WebWatcher Internal Functions public int SetSite(object site) { if (site != null) { webBrowser = (WebBrowser)site; webBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); webBrowser.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2); } else { webBrowser.DocumentComplete -= new DWebBrowserEvents2_DocumentCompleteEventHandler(this.O
-
Hello everyone, I am working on a Browser Helper Object (BHO) and have created a Class Library with the following code.
using System; using System.Collections.Generic; using System.Text; using SHDocVw; using mshtml; using System.IO; using Microsoft.Win32; using System.Runtime.InteropServices; namespace WebWatcher { [ComVisible(true), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")] public interface IObjectWithSite { [PreserveSig] int SetSite([MarshalAs(UnmanagedType.IUnknown)]object site); [PreserveSig] int GetSite(ref Guid guid, out IntPtr ppvSite); } [ ComVisible(true), Guid("8a194578-81ea-4850-9911-13ba2d71efbd"), ClassInterface(ClassInterfaceType.None) ] public class BHO : IObjectWithSite { WebBrowser webBrowser; HTMLDocument document; public void OnDocumentComplete(object pDisp, ref object URL) { document = (HTMLDocument)webBrowser.Document; foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT")) { System.Windows.Forms.MessageBox.Show(tempElement.name != null ? tempElement.name : "it sucks, no name, try id" + ((IHTMLElement)tempElement).id); } } public void OnBeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) { document = (HTMLDocument)webBrowser.Document; foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT")) { if (tempElement.type.ToLower() == "password") { System.Windows.Forms.MessageBox.Show(tempElement.value); } } } #region WebWatcher Internal Functions public int SetSite(object site) { if (site != null) { webBrowser = (WebBrowser)site; webBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete); webBrowser.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2); } else { webBrowser.DocumentComplete -= new DWebBrowserEvents2_DocumentCompleteEventHandler(this.O
Couple things off the top of my head: have you hooked Visual Studio up to Microsoft's symbol store for IE? Have you tried attaching a debugger to IE itself?
Tech, life, family, faith: Give me a visit. I'm currently blogging about: The Lord Is So Good The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
Couple things off the top of my head: have you hooked Visual Studio up to Microsoft's symbol store for IE? Have you tried attaching a debugger to IE itself?
Tech, life, family, faith: Give me a visit. I'm currently blogging about: The Lord Is So Good The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
Hello Judah, Thanx for the reply. In order to debug the BHO code, i did the following. I typically have my IE home page set to about:blank . That way I can start up the browser as fast as possible and go where I need to. So, start up the first IE window. The from VS.NET, I use the Attach to Process item in the Debug menu to attach to iexplore.exe . Set breakpoints in my BHO. To break within the constructor. I hope I was able to explain how I run the debug. Thank you very much and have a great weekend. Khoramdin