bgiExecuteHTMLScript

Executes JavaScript code in the context of the loaded HTML document. Takes htmlViewID (Int) and script (String). Returns value (script result discarded).

BGI GUI

Parameters & Returns

Parameters

htmlViewID Int
script String

Returns

Void

Quick Summary

Executes JavaScript code in the context of the loaded HTML document. Takes htmlViewID (Int) and script (String). Returns value (script result discarded).

Technical Exegesis...

Executes JavaScript code in the context of the loaded HTML document. Searches webBrowserMap for htmlViewID. If found, gets IWebBrowser2* interface. Gets IDispatch via get_Document(), queries for IHTMLDocument2. Calls get_parentWindow() to obtain IHTMLWindow2 interface. Converts UTF-8 script string to BSTR using MultiByteToWideChar. Calls pWindow->execScript(bstrScript, L"JavaScript", &vResult) to execute JavaScript. SysFreeString releases BSTR. Releases COM interfaces.

Example

Example.bam
; No example implemented yet