ihtmldocument2

IHTMLDocument2 Printing without Dialog Box

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 14:00:09
问题 I've been working on a project that automatically prints HTML invoices. It's been particularly challenging as I've needed to keep the CSS formatting. Following advice, I've found myself using IHTMLDocument2 to carry out my printing. I'm supposed to be able to: mshtml.IHTMLDocument2 doc = new mshtml.HTMLDocument() as mshtml.IHTMLDocument2; doc.write(htmlContent); //htmlContent is a string of HTML doc.execCommand("PRINT", false, null); The second argument specifies whether to produce the

IHTMLEventObj::put_keyCode fails in IE9 RC

瘦欲@ 提交于 2020-01-01 19:59:35
问题 I have an IE BHO created over 3 years ago that uses IHTMLEventObj::put_keyCode function. This function has worked as documented in IE6, IE7 and IE8. However, when testing with IE9 RC it no longer works as documented. The function is called the same way and the result is S_OK, but the key does not show up in the input field. The call is being made in the DISPID_HTMLELEMENTEVENTS2_ONKEYPRESS even of my Invoke() function. I found someone with a similar problem: http://social.msdn.microsoft.com

MSHTML tutorial [closed]

微笑、不失礼 提交于 2019-12-21 17:02:22
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I want to learn some basics about MSHTML, like how to use IHtmlDocument and IHtmlDocument2 interfaces. I searched for quite a while,

Webbrowser Control - displaying text using “write”

无人久伴 提交于 2019-12-20 03:21:46
问题 I'm using the IWebBrowser2 interface to render a page from an HTML string created at runtime. I have written a method (let's call it DisplayHtmlString) that takes an HTML string and renders it as shown in this example. The method also calls Navigate2 with "about:blank" first, to ensure a document is present, and it also calls close after calling write. The first time I call DisplayHtmlString, the page is always rendered correctly, i.e. the browser displays HTML according to the string I pass.

IHTMLDocument2 - click button inside iframe

泄露秘密 提交于 2019-12-13 04:27:07
问题 I'm creating a DCOM extension for some really old application. Main application has IE control inside of it. Using C# I was able to get handler for that IE Control as below: Process pr = Process.GetCurrentProcess(); var title = pr.MainWindowTitle; if(title.IndexOf("My old application -")<0) { MessageBox.Show("No such window"); return; } var wlwWindow = pr.MainWindowHandle; var ieWindow = PI.FindWindowRecursive(wlwWindow, "Internet Explorer_Server", null); if (ieWindow == IntPtr.Zero) {

Why do I get an access violation when setting the value of an IHTMLInputTextElement?

筅森魡賤 提交于 2019-12-11 03:26:49
问题 I get the following error: Access Violation at address 0050AA07 in module "project1.exe". Read of address 00000000. I'm trying to auto fill a form in TWebBrowser. It's just a field called 'login' on a form. What does it mean? How do I solve it? procedure TForm1.Button2Click(Sender: TObject); var doc: IHTMLDocument2; frm: IHTMLFormElement; fld: IHTMLInputTextElement; begin doc := webbrowser1.Document as IHTMLDocument2; frm := doc.forms.item(0, EmptyParam) as IHTMLFormElement; fld := frm.item(

Detect cursor position in TWebBrowser at edit mode

淺唱寂寞╮ 提交于 2019-12-11 02:20:10
问题 I get selection range like this: var Range: IHTMLTxtRange; begin if Supports((Document as IHTMLDocument2).selection.createRange, IHTMLTxtRange, Range) end; TWebBrowser in editing. I need get position of cursor. How I can get its? 回答1: IHTMLTxtRange defines several attributes to get what you need. But the key items are boundingLeft and boundingTop This link has some details on how it works as well. 来源: https://stackoverflow.com/questions/2621883/detect-cursor-position-in-twebbrowser-at-edit

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

Trying to edit IHTMLDocument hangs an application

大兔子大兔子 提交于 2019-12-08 07:21:09
问题 based on MSHTML documentation for IHTMLDocument2 I'm trying to write simple HTML parser. Unfortunately trying to set edit-mode fails, in other words resultState never gets 'complete' value so application hangs. {$APPTYPE CONSOLE} function ParseHtml(doc: TStringList): TStringList; var iHtml: IHTMLDocument2; v: Variant; msg: tagMSG; begin iHtml := CreateComObject(CLASS_HTMLDocument) as IHTMLDocument2; Result := TStringList.Create; try try iHtml.designMode := 'on'; while iHtml.readyState <>

IHTMLEventObj::put_keyCode fails in IE9 RC

♀尐吖头ヾ 提交于 2019-12-04 21:18:09
I have an IE BHO created over 3 years ago that uses IHTMLEventObj::put_keyCode function. This function has worked as documented in IE6, IE7 and IE8. However, when testing with IE9 RC it no longer works as documented. The function is called the same way and the result is S_OK, but the key does not show up in the input field. The call is being made in the DISPID_HTMLELEMENTEVENTS2_ONKEYPRESS even of my Invoke() function. I found someone with a similar problem: http://social.msdn.microsoft.com/Forums/is/ieextensiondevelopment/thread/abcbaffd-ed8a-45b8-840b-8ad8d7d10081 , however for some reason I