javascript - IHTMLDOMNode::appendChid() won't always work as expected -


i writing bho in c++ involves 2 stages.

stage 1: open new window bho , navigate website url (from bho), inject javascript code document once dispid_documentcomplete event fires appropriate url, invoke code js. js engine crunch more code , point window @ other url means of window.location.href.

stage 2: once dispid_documentcomplete fires inside bho new url flow goes same route: inject script, etc. trouble.

  1. happens on win 7 32 bits + ie11, not happen on win xp 32bits + ie8
  2. issue stage 2 - injection fails. have tried appendchild on both first body tag , first head tag same result.
  3. there tests hresult return values involved , validity of interface pointers returned , pass
  4. but when time comes invoke function script, getidsofnames() returns hresult of -2147352570 (unknown name) when passing name of function javascript code.
  5. inspecting dom in ie reveals js code not injected
  6. this happens when ie launched , no more mouse clicks or keyboard events occur. happens, however, in 5% or less of cases ie launched , click occurs (anywhere - desktop, title bar, client area of window).

attempts fix this: used sendinput() in order simulate mouse click. works described above @ point 6. used timer fired on second url dispid_documentcomplete event , went on injection after seconds - crashes browser when ihtmldocument2::createelement() gets called.

any reasons strange behaviour , perhaps way fix ? thanks!

looks had renew iwebbrowser2 instance - changes upon page navigation. fetch new interface pointer querying second parameter sent along dispid_documentcomplete event.

link it: https://msdn.microsoft.com/en-us/library/aa768282%28v=vs.85%29.aspx


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -