mshtml

Using MSHTML for the GUI in C++, is there perhaps a tutorial?

I would like to migrate my app to using MHTML for the GUI since it would be much easier to experiment with layouts without rewriting the C++ every time. Is there a tutorial? What I found is unfortunately not what I need, which is: Feed it HTML from memory Receive events such as onclick, etc., back in my C++ code Manipulate it through ...

.NET mshtml: How to pass a BSTR SAFEARRAY?

The class mshtml.HTMLDocumentClass in Microsoft.mshtml.dll assembly has a method: public virtual void write(params object[] psarray); Avoiding the real question for a moment, what code would you use to call write()? Would you use: String html = "<html><body>Hello, world!</body></html>"; mshtml.HTMLDocumentClass doc; ... doc.write(htm...

How to enable Multi-Level undo/redo in mshtml & c#

I have a System.Windows.Forms.Webbrowser control hosted in a Winforms app and am loading up a html document that has various elements with the contentEditable attribute set to true. How do I enable multi-level undo and redo for the document? TIA. MB ...

How do I use MSHTML in VB.NET?

In the answer to question #56107, Erlend provided this sample c# code: using mshtml; ... object[] oPageText = { html }; HTMLDocument doc = new HTMLDocumentClass(); IHTMLDocument2 doc2 = (IHTMLDocument2)doc; doc2.write(oPageText); I'd like to use mshtml in VB.NET, but the IDE doesn't recognize this: Imports mshtml What additional st...

MSHTML - Auto Click for javascript confirm dialog

I try to automatically parse/submit web page using MSHTML (in C#.Net 3.1 WPF WebBrowser control). I can fill the forms, click buttons, naviagate pages without problems. But do not know how to automatically click "ok" button on javascript confirmation dialog which appear when I click "Submit" button. C# code: mshtml.IHTMLDocument2 doc =...

WPF WebBrowser Overwrite Javascript

Hi, I work with WPF WebBrowser control which different from WinForms and many recommendations from this excellent web site simply does not work in WPF. I try to find solution how I can overwrite particular javascript function btnSubmit_onclick() on a web page. This function generates confirm dialog (like "Are you sure?") which I want t...

How to get Ajax response from MSHTML??

Hello, Does anyone have any ideas about how to intercept an ajax response to a textbox on the browser page? The text box is an autosuggest ajax control and I'm sending keystrokes to it and trying to see if what comes back to the textbox's dropdown is correct. Using c#. Haven't found anything related to this online so far. Thanks! ...

How can we use MSHTML with VBA?

I saw a lot of examples in MSDN on how to use MSHTML in VS. Have anyone known if and how we can use MSHTML and VBA to open web pages? Thanks. ...

Internet Explorer Automation: how to suppress Open/Save dialog?

When controlling IE instance via MSHTML, how to suppress Open/Save dialogs for non-HTML content? I need to get data from another system and import it into our one. Due to budget constraints no development (e.g. WS) can be done on the other side for some time, so my only option for now is to do web scrapping. The remote site is ASP.NET-...

get an html element top and left properties data

i'm using the mshtml dll to develop a helper to ie, i'm trying to get the position of an htmll element, i have an object with type of HTMLAnchorElementClass when i'm trying to get his style.posTop value i get a null ref exception is there a better way to do it? maybe other cast? please help ...

How to get the absolute position of a nested htmlelement using mshtml?

hello i need to place a tooltip above an htmlelemnt, i cant place the tooltip inside the parent of the element because of z-index possible problems, i need a way to get the absolute position of the element, i got him as a HTMLAnchorElementClass ...

MSHTML tutorial

Hello everyone, I want to learn some basics about MSHTML, like how to use IHtmlDocument and IHtmlDocument2 interfaces. I searched for quite a while, but can not find out a tutorial for beginners. Could anyone recommend something to read? EDIT: I prefer to use C#. thanks in advance, George ...

HTML - How do I know when all frames are loaded?

I'm using .NET WebBrowser control. How do I know when a web page is fully loaded? I want to know when the browser is not fetching any more data. (The moment when IE writes 'Done' in its status bar...). Notes: The DocumentComplete/NavigateComplete events might occur multiple times for a web site containing multiple frames. The browse...

How do I save a web page to image (using C#)

I have a WebBrowser control and I want to save the whole page viewed to image (any web page). I tried using IHTMLElementRender interface but it didn't work for all web pages. Maybe I'm doing something wrong because sometimes the snapshot included the scrollers and sometimes it was just partial. Do you have a working example that can save...

C#: Best way to inject CSS into MSHTML instance?

Hey everyone, I'm trying to inject some CSS that accompanies some other HTML into a C# managed WebBrowser control. I am trying to do this via the underlying MSHTML (DomDocument property) control, as this code is serving as a prototype of sorts for a full IE8 BHO. The problem is, while I can inject HTML (via mydomdocument.body.insertAdj...

problem with IHTMLDocument2::write()

I am trying to create an mshtml document object from an html buffer. But when the following code is executed it is invoking internet explorer window. How do I prevent it invoking IE. #include <atlbase.h> #include <mshtml.h> CoInitialize(NULL); CString strHTMLCode = _T("<html><head><script language=\"JavaScript\">{top.location.href=\"...

How to set a checkbox to "checked" using mshtml?

Hi, I can do most things I need to with mshtml, but I'm a bit stuck with how to set a checkbox input element to "checked". Here's the situation... IHTMLElementCollection inputElements = (IHTMLElementCollection)doc.all.tags("input"); foreach (IHTMLElement el in inputElements) { string elementHtml = el.outerHTML; string termsOfSe...

Using the MSHTML interfaces IHTMLChangeSink, IHTMLChangeLog and RegisterForDirtyRange in VB6

Is this even possible? I can implement IHTMLChangeSink, but not IHTMLChangeLog, but I cannot call RegisterForDirtyRange or CreateChangeLog in VB6. ...

How do I detect changes to the document in a WebBrowser control in Edit mode, using VB6 ?

We are building a HTML edit control using a VB6 wrapper around the WebBrowser control and MSHTM documents. We are having problems detecting if the document has been modified by the user. VB6 does not support using the IHTMLChangeSing and IHTMLChangeLog interfaces so these seem to be non-starters. What other events from either the WebB...

How to capture events fired from new Popup IE window

Hi, Greetings! Situation: My ActiveX DLL contains a customized webbrowser. The webbrowser displays a web page. When user clicks the link within the displayed page, a new IE window pop up and navigate to the clicked link URL. Question: How can I capture the DocumenComplete and NavigateComplete events fired from the NEW pop up IE win...