comparison win/browser.c @ 2016:f696215e6d4e

Win: First attempt at implmenting dw_html_javascript_run() for embedded IE.... Doesn't seem to work but it compiles.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 07 Nov 2019 11:18:46 +0000
parents c30f4354966e
children 686b2d049056
comparison
equal deleted inserted replaced
2015:c30f4354966e 2016:f696215e6d4e
1431 * RETURNS: 0 if success, or non-zero if an error. 1431 * RETURNS: 0 if success, or non-zero if an error.
1432 */ 1432 */
1433 1433
1434 int _dw_html_javascript_run(HWND hwnd, LPCWSTR script, void *scriptdata) 1434 int _dw_html_javascript_run(HWND hwnd, LPCWSTR script, void *scriptdata)
1435 { 1435 {
1436 IHTMLWindow2 *htmlWindow2;
1437 IOleObject *browserObject;
1438 VARIANT retVal;
1439
1440 // Retrieve the browser object's pointer we stored in our window's GWL_USERDATA when
1441 // we initially attached the browser object to this window.
1442 browserObject = *((IOleObject **)dw_window_get_data(hwnd, "_dw_html"));
1443
1444 // We want to get the base address (ie, a pointer) to the IWebBrowser2 object embedded within the browser
1445 // object, so we can call some of the functions in the former's table.
1446 if (!browserObject->lpVtbl->QueryInterface(browserObject, &IID_IHTMLWindow2, (void**)&htmlWindow2))
1447 {
1448 BSTR myscript = SysAllocString(script);
1449 if (myscript)
1450 {
1451 htmlWindow2->lpVtbl->execScript(htmlWindow2, myscript, NULL, &retVal);
1452 SysFreeString(myscript);
1453 }
1454 // We no longer need the IWebBrowser2 object (ie, we don't plan to call any more functions in it,
1455 // so we can release our hold on it). Note that we'll still maintain our hold on the browser
1456 // object.
1457 htmlWindow2->lpVtbl->Release(htmlWindow2);
1458 }
1436 return DW_ERROR_UNKNOWN; 1459 return DW_ERROR_UNKNOWN;
1437 } 1460 }
1438 1461
1439 1462
1440 /******************************* ResizeBrowser() **************************** 1463 /******************************* ResizeBrowser() ****************************