locked
OLECMDID_OPTICAL_ZOOM is not updated when pinch-to-zoom is performed on Win 8.1 and IE 11 RRS feed

  • Question

  • I need to get the current zoom level of the browser control.  In most cases I can, however, OLECMDID_OPTICAL_ZOOM (nor OLECMDID_ZOOM) is not updated when pinch-to-zoom is performed.  In case it matters, the code to get optical zoom is below.  Note that, Ctrl +/- do the same thing (graphically), and optic zoom IS updated in that case.

    int GetOpticZoom()
    {
    	VARIANT vOut;
    	VariantInit(&vOut);
    	ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, NULL, &vOut);
    	return (vOut.vt == VT_I4 ? vOut.lVal : 100);
    }

    Can anyone explain why optic zoom is not being updated on Win 8.1 (IE 11) when pinch-to-zoom is performed?

    Thursday, March 27, 2014 7:57 PM

All replies

  • You could use an OLE commands through ExecWB on the ActiveX instance: OLECMDID_ZOOM for text size and OLECMDID_OPTICAL_ZOOM for optical zoom. For example,

    object pvaIn = 200; // A VT_I4 percentage ranging from 10% to 1000%
    var browserInst = ((SHDocVw.IWebBrowser2)(browserContol.ActiveXInstance));
    browserInst.ExecWB(SHDocVw.OLECMDID.OLECMDID_OPTICAL_ZOOM,
                       SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
                       ref pvaIn, IntPtr.Zero);

    please check out the links for details:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms691264(v=vs.85).aspx

    How to zoom content of Webgadget -

    WPF WebBrowser control zoom in/out support

    Hope it helps you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 28, 2014 8:45 AM
  • The ExecWB function I have above does that, which is why I said it works in most cases.  One case where zoom is not updated is when a pinch-to-zoom is done by the user.  I don't know if it's a bug in the browser control where it is not updating the optical zoom value internally for access to the outside, or if something else is going on.
    Monday, March 31, 2014 5:30 PM
  • I just found out that you cannot reproduce this issue unless your app is added to the FEATURE_NINPUT_LEGACYMODE and set to 0.  We need to disable legacy mode for many reasons.
    Thursday, April 3, 2014 7:04 PM