mshtml

Using HTMLDocument to manipulate HTML and show it in WebBrowser-control

若如初见. 提交于 2019-12-11 14:57:53
问题 I am trying to manipulate a requested document in the WPF WebBrowser-control. I already managed it to invoke JavaScript on loaded document, but I am not able to change the shown HTML-code in the control itself. My (very simplified) code in the OnNavigating-Handler looks like this: mshtml.HTMLDocument doc = (mshtml.HTMLDocument)View.browser.Document; HTMLTableClass table = doc.getElementById("someTable") as HTMLTableClass; if (table != null) { table.appendChild((IHTMLDOMNode)(doc.createElement

IHTMLElement -> IAccessible

旧时模样 提交于 2019-12-11 13:13:20
问题 How to get IAccessible from IHTMLElement? I have receive "Interface is not support" error. 回答1: Not all HTML elements are accessible. See Accessible HTML Elements (there's also a list of accessible elements below). You might have hit an element that is not meant to be accessible. 回答2: Use IServiceProvider::QueryService - full details at this article. Basic idea is that QueryService is like a less strict version of QI: QI requires that all the interfaces are part of the same COM object and

Embedded MSHTML: mouse wheel ignored

瘦欲@ 提交于 2019-12-11 07:15:45
问题 In my VC++ application I have an embedded browser (MSHTML). It works fine and handles the mouse properly (for instance, clicks and selects are processed OK). However, mouse wheel rotations over the embedded browser do not have any effect. This is my problem. I am not very familiar with the internals of MSHTML embedding, and OLE in general. This is an wxWidgets application (wxWidgets is a C++ GUI library), and I am making use of its IEHTMLWin component (which hosts an MSHTML control and wraps

Can't assign HTML to HTMLDocument.body

喜夏-厌秋 提交于 2019-12-11 06:08:07
问题 I wanted to use HTMLDocument object from mshtml library. I was trying to assign HTML to document: var doc = new mshtml.HTMLDocument(); var html = File.ReadAllText(@"path_to_html_file"); doc.body.innerHTML = html; // <-- this line throws error However, I get error on the third line: System.NullReferenceException: 'Object reference not set to an instance of an object.' mshtml.DispHTMLDocument.body.get returned null. I was trying to use dynamic code, but it didn't work either: dynamic doc =

Casting mshtml.IHTMLImgElement to mshtml.IHTMLElementRender fails with E_NOINTERFACE

Deadly 提交于 2019-12-11 04:48:46
问题 I have C# .NET 4 WinForms app (using MSHTML 7) that launches new and connects to existing IE 10 instances. It iterates through all images and downloads them to manipulate. This approach is time-consuming and redundant since the image has already been downloaded by IE. I have searched everywhere and only a handful of forums discuss the subject but all are able to cast mshtml.IHTMLImgElement objects to mshtml.IHTMLElementRender (although in C++ code). Unable to cast COM object of type 'mshtml

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

C# WPF Webbrowser msHTML - Explore DOM - Find Elements

会有一股神秘感。 提交于 2019-12-11 02:31:24
问题 I'm actually working on a personal project in C# using WPF and WPF WebBrowser. I really need to explore html DOM Elements as we used to do in javascript or php..etc In my MainWindow I have this variable : private mshtml.HTMLDocument mainDocument = new mshtml.HTMLDocument(); In my webBrowser LoadComplete callback I have this : mainDocument = (mshtml.HTMLDocument) mainBrowser.Document; Ok, so this is nice, it's working. Now if I do this : mshtml.IHTMLElement elem = mainDocument.getElementById(

WYSIWYG html editor query

ぃ、小莉子 提交于 2019-12-10 23:14:22
问题 I am in the process of creating a simple WYSIWYG HTML editor to enable the users of my application to design simple HTML emails. At the moment I have decided to use the web browser control with MSHTML to enable me to edit what is displayed. I have a tool bar which holds all of the relevant buttons, bold, underline, etc. I need a way to check if the current block has any formatting so the correct state can be displayed on the buttons in the tool bar. I tried to add an event handler to the

Detect scroll on a WebBrowser control

。_饼干妹妹 提交于 2019-12-10 15:47:29
问题 I have the following code that, weirdly, works for a couple of seconds and then stops working (my event handler method stops being called): public partial class Form1 : Form { private void Form1_Load(object sender, EventArgs e) { webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted); webBrowser1.Navigate("google.com"); } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (!webBrowser1

Debugging SHDocVw.InternetExplorer.Quit not closing iexplore.exe process

耗尽温柔 提交于 2019-12-10 14:34:33
问题 I think there's no definite answer so how would you approach debugging this problem?: My main app (a MicroStation plugin) launces IE using the SHDocVw.InternetExplorer COM wrapper, interacts with it, hides it when it is not used (e.g. intercepts when the user closes the window and sets InternetExplorer.Visible to false). When the main app is closed the plugin closes IE by calling InternetExplorer.Quit but the iexplore process is left running (the IE is hidden at the moment the main app is