Where is ExecWB?
<p>If I use WPF syntax:</p>
<pre><code>&lt;WebBrowser Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; x:Name=&quot;htmlView&quot;&gt;&lt;/WebBrowser&gt;
</code></pre>
<p>Or if I add a <code>WindowsFormsHost</code>:</p>
<pre><code>&lt;WindowsFormsHost x:Name=&quot;formsHost&quot; Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot;&gt;
&lt;/WindowsFormsHost&gt;
</code></pre>
<p>And in the CS file:</p>
<pre><code>public partial class MainWindow : Window
{
    System.Windows.Forms.WebBrowser htmlView= new System.Windows.Forms.WebBrowser();

    public MainWindow()
    {
        InitializeComponent();

        formsHost.Child = htmlView;
        htmlView.Navigate(&quot;d:\\test.xml&quot;);
    }

    private void menuFilePageSetup_Click(object sender, RoutedEventArgs e)
    {
        MessageBox.Show(&quot;Do do&quot;);
    }
}
</code></pre>
<p>Either way, the <code>ExecWB</code> method is not exposed. So I can't port this code over from my MFC C++ CHtmlView derived class:</p>
<pre><code>ExecWB(OLECMDID_PAGESETUP, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
</code></pre>
<p>Am I missing something? At this point in time I can't implement my print preview / page setup / zoom functionality because I can't use <code>ExecWB</code>.</p>
<p>I have tried deriving my own class from the Winforms browser but it is still not listed.</p>
<p>Thank you.</p>
<p>I don't understand why in this question:</p>
<p><a href="https://stackoverflow.com/questions/714507/how-do-i-programatically-change-printer-settings-with-the-webbrowser-control">How do I programmatically change printer settings with the WebBrowser control?</a></p>
<p>It refers to <code>ShowPrintDialog</code> but even that is not listed.</p>
<p>Partial success! I don't know why, but now, when I use the hosted Winforms version, I can atleast see some of the methods:</p>
<pre><code>public partial class MainWindow : Window
{
    System.Windows.Forms.WebBrowser htmlView= new System.Windows.Forms.WebBrowser();

    public MainWindow()
    {
        InitializeComponent();

        formsHost.Child = htmlView;
        htmlView.Navigate(&quot;d:\\test.xml&quot;);
    }

    private void menuFilePageSetup_Click(object sender, RoutedEventArgs e)
    {
        htmlView.ShowPageSetupDialog();
    }

    private void MenuItem_Click(object sender, RoutedEventArgs e)
    {
        htmlView.ShowPrintPreviewDialog();
    }
}
</code></pre>
<p>But <code>ExecWb</code> is still missing for managing things like zooming. I found this:</p>
<p><a href="https://stackoverflow.com/questions/798494/how-do-i-print-from-the-wpf-webbrowser-available-in-net-3-5-sp1">How do I print from the wpf WebBrowser available in .net 3.5 SP1?</a></p>
<p>One of the answers:</p>
<blockquote>
<pre><code>mshtml.IHTMLDocument2 doc = webBrowser.Document as mshtml.IHTMLDocument2;
doc.execCommand(&quot;Print&quot;, true, null);
</code></pre>
</blockquote>
<p>But even if I add a reference to the mshtml library the compiler will not let me convert from <code>HtmlDocument</code> to <code>IHtmlDocument2</code>. Eventually I got this:</p>
<p><a href="https://stackoverflow.com/questions/21282437/clearing-the-selection-in-a-webbrowser-control">Clearing the selection in a webbrowser control</a></p>
<p>So now I know how to select all and copy to clipboard again (as long as I use the Winforms edition). However, having looked here:</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms533049(v=vs.85).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/ms533049(v=vs.85).aspx</a></p>
<p>There seems to be no match for <strong>Optical Zoom</strong>:</p>
<pre><code>ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &amp;vZoom, NULL);
</code></pre>