webbrowser-control

Getting WebBrowser Control To Work In Console Application?

依然范特西╮ 提交于 2019-11-30 18:08:46
I have a printer class that is capable of printing HTML via the WebBrowser object. I want to be able to print from a console application, but I get an error when my printer class tries to create a WebBrowser object: WebBrowser browser = new WebBrowser(); Error: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment. I tried adding a reference to System.Windows.Forms into my console application but that didn't work. I don't have the slightest idea of what's going on here, but I would appreciate the help.

Overriding IE settings when embedding a WebBrowser control using IE9

我只是一个虾纸丫 提交于 2019-11-30 16:09:57
问题 I have an application (written in C++ with MFC, but I don't think that that's particularly relevant) that embeds the Internet Explorer ActiveX WebBrowser control for the purpose of showing some HTML pages. One requirement has always been to use the application's font name and size settings as the default settings for the HTML, rather than Internet Exporer's defaults. To achieve this, the application implements the IDocHostUIHandler2 COM interface, which it passes to the WebBrowser control.

WebBrowser Control - Console Application - Events Not Firing

别等时光非礼了梦想. 提交于 2019-11-30 16:09:28
I have been navigating the various WebBrowser control stackoverflow questions , and I can't seem to find an answer to a problem I am having. I am trying to use the WebBrowser control to print a web page . Following MSDN's example , I have created the following console application: namespace WebPrintingMadness { using System; using System.Collections.Generic; using System.Text; /// <summary> /// The entry point of the program. /// </summary> class Program { /// <summary> /// The main entry point of the program. /// </summary> /// <param name="args">Program arguments.</param> [STAThread] public

Overriding IE settings when embedding a WebBrowser control using IE9

强颜欢笑 提交于 2019-11-30 15:55:14
I have an application (written in C++ with MFC, but I don't think that that's particularly relevant) that embeds the Internet Explorer ActiveX WebBrowser control for the purpose of showing some HTML pages. One requirement has always been to use the application's font name and size settings as the default settings for the HTML, rather than Internet Exporer's defaults. To achieve this, the application implements the IDocHostUIHandler2 COM interface, which it passes to the WebBrowser control. This causes the control to call the application's implementation of GetOptionKeyPath , which lets the

How to load HTML/JavaScript from embedded resource into winform web browser

南楼画角 提交于 2019-11-30 15:34:18
问题 I want to have some HTML files with JavaScript loaded into the web browser control in a winforms (v2.0) application. During execution, I won't have internet access, so JavaScript and HTML forms will be embedded in he resources.resx file. 1) how can I load an HTML document out of the resource (analogous to a file:/// operation, but it isn't being loaded from the file system), 2) how would I declare the JavaScript scripts to be loaded? I.e., <script src=resource.jquery.min.js??? ... /> Thanks!

WPF WebBrowser Browser Version

久未见 提交于 2019-11-30 15:31:29
问题 Does the WPF WebBrowser control depend on the version of IE that is installed on the user's machine, or does it use a separate library that is consistent across machines? I've read that it only renders in IE7 mode, but I want to make sure there wouldn't be any issues with a user who either doesn't have IE installed or is still on IE6 for some reason. 回答1: The MSDN remarks for WebBrowser indicate it rehosts the IE ActiveX control: The WebBrowser control internally instantiates the native

Programmatically changing the destination printer for a WinForms WebBrowser control

非 Y 不嫁゛ 提交于 2019-11-30 15:09:04
I'm trying to use an invisible WebBrowser control to print a very simple HTML document. Our application requires that we be able to print several documents this way, and that they all can be sent to different printers. Unfortunately, I haven't been very successful in making the output go to the right printer. The way it works right now is that before printing a document, the application determines which printer is to receive it, and sets the default printer accordingly. To do this it uses SetDefaultPrinter() imported from WinSpool.drv. If I step the code in debug mode I can clearly see that

Excel VBA create an embedded WebBrowser and use it

China☆狼群 提交于 2019-11-30 14:24:32
Hi I'm trying to dynamically create a web browser inside a spreadsheet and then use it but the WebBrowser functions don’t seem to work Here is how I create the WebBrowser Set myWebBrowser = Sheets("test").OLEObjects.Add(ClassType:="Shell.Explorer.2", Link:=False, DisplayAsIcon:=False, left:=147, top:=60.75, width:=141, height:=96) This will work myWebBrowser.top = 10 But this will give me an error myWebBrowser.Navigate ("about:blank") Any ideas on what should I do thank you UPDATE: This will also don't work and give an error: myWebBrowser.Object.Document.body.Scroll = "no" myWebBrowser.Object

Use a proxy with webBrowser control C#/.net 3.5

送分小仙女□ 提交于 2019-11-30 14:23:50
I need some help from someone who has already use the webBrowser control along with a proxys. What I need is the following. 1 - Set a proxy for a webBrowser control. 2 - Load a specific site. 3 - Execute a routine over the site. 4 - Set a diferent proxy for the webBrowser control. 5 - Load another site. 6 - Execute the same routine from point number 3. And the process keeps in that way, looping from a list of proxys, until all of them had been used. But. I'm having some problems with the app. to do that: 1 - I'm using the code attached to set the proxy into the webBrowser control, but seems to

How to force Web Browser control to always open web page in the same window?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 14:01:51
问题 I need to use web browser in my application as it keeps repetitive tasks from employees, but there is a problem with javascript that opens a new window in IE after clicking on anchor. How do I tell web browser control to "open new window" where I want it to be opened? For example in the other web browser control? 回答1: Check out: proof-of-concept of .NET System.Windows.Forms.WebBrowser module using source code My experience about that controls has given me a vision that this issue can tried to