Skip to content

Commit

Permalink
Trying to fix MSHTML errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Emulator000 authored and richardhozak committed Dec 9, 2020
1 parent 0d832e2 commit eb621f8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion webview-sys/webview_mshtml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,14 +1174,23 @@ WEBVIEW_API void webview_set_color(webview_t w, uint8_t r, uint8_t g,
}

WEBVIEW_API void webview_set_zoom_level(webview_t w, const double percentage) {
struct mshtml_webview* wv = (struct mshtml_webview*)w;

int OLECMDID_OPTICAL_ZOOM = 63;
int OLECMDEXECOPT_DONTPROMPTUSER = 2;

VARIANT vPercentage;

VariantInit(&vPercentage);

vPercentage.vt = VT_R8;
vPercentage.dblVal = percentage;

IWebBrowser2 *webBrowser;
IOleObject *browser = *wv->browser;
if (browser->lpVtbl->QueryInterface(browser, iid_unref(&IID_IWebBrowser2),
(void **)&webBrowser) == S_OK) {
webBrowser->lpVtbl->ExecWB(webBrowser, OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &percentage, percentage);
webBrowser->lpVtbl->ExecWB(webBrowser, OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &vPercentage, &vPercentage);
}
}

Expand Down

0 comments on commit eb621f8

Please sign in to comment.