Outlook外接程序-Visual Basic Windows窗体应用程序-WebBrowser控件内容不再显示 [英] Outlook Addin - Visual Basic Windows Forms Application - WebBrowser Control Content not displayed anymore

查看:156
本文介绍了Outlook外接程序-Visual Basic Windows窗体应用程序-WebBrowser控件内容不再显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Outlook外接程序(Visual Basic .NET Framework 4客户端配置文件,Office 365业务16.0.11727.20230)在WebBrowser控件中显示一些内容.我对Visual Basic不太熟悉,因为其他人创建了此插件,而他现在不再可用,所以首先对不起,如果我犯了任何基本错误.

实际上,该控件应该显示一些.xml内容,但是为了简化问题,我只是尝试显示网页 https://目前为www.google.at . 在此插件中显示内容始终可以正常工作,并且自从上一次Windows/办公室更新以来,我得到的是白屏,没有代码错误. 如果我创建了一个新的Windows窗体应用程序,并且该控件在没有Outlook的情况下运行,则显示的内容没有任何问题(uri和实际的.xml),因此我认为它与新的Outlook安全性设置或类似内容有关. /p>

该控件使用lib Windows.Forms.WebBrowser,URL设置如下:

 Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim url = "https://www.google.at"           
            Call WebBrowser1.Navigate(New System.Uri(url))
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

我已经弄清楚,如果我启用了文件/常规选项下的优化兼容性"设置,则该控件将显示我的内容,但实际上,我希望它不使用该设置就显示内容,因为我认为这不应该是必要的.

显示内容的另一种方法是使用"Microsoft Web浏览器"(AxSHDocVw.AxWebBrowser)控件.这个也显示了我的内容,但是有一个较旧的UI,我不知道如何用这个禁用滚动条. 不知道此信息是否有助于找出System.Windows.Forms控件为何不显示内容.

感谢您提供任何帮助或建议,以帮助我重新获得控制权以显示其中的某些内容.

解决方案

WebBrowser控件是ActiveX WebBrowser控件的托管包装,并且使用用户计算机上安装的任何版本的控件.

WebBrowser 控件不能被部分受信任的代码使用.有关更多信息,请参见使用部分受信任代码中的库.

WebBrowser 类只能在设置为单线程单元(STA)模式的线程中使用.要使用此类,请确保您的Main方法标记有 STAThreadAttribute 属性.

We are using an outlook addin (visual basic .NET framework 4 client profile, office 365 business 16.0.11727.20230) that displays some content within a WebBrowser control. I'm not that familiar with visual basic because someone else created this addin and he is not available anymore now, so first of all sorry if i made any basic mistake.

Actually the control should display some .xml content but to simplify the question im just trying to display the webpage https://www.google.at for the moment. Displaying the content within this plugin was always working and since the last windows/office update all i get is a white screen with no code error. If i create a new windows forms application with the same control that runs without outlook the content is displayed without any problems (uri and the actual .xml) so i assume it has something to do with new outlook security settings or something like this.

The control uses the lib Windows.Forms.WebBrowser and the url is set like this:

 Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim url = "https://www.google.at"           
            Call WebBrowser1.Navigate(New System.Uri(url))
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

I already figured out, that the control displays my content if i enable the setting 'optimize for compatibility' under files/general options but actually i'd like that it displays the content without using that setting because i think that should not be necessary.

Another way to display the content would be to use the "Microsoft Web Browser" (AxSHDocVw.AxWebBrowser) control. This one displays my content too but has an older UI and i can't figure out how to disable the scrollbars with this one. Don't know if this information helps to figure out why the System.Windows.Forms control does not display the content.

Thanks for any help or suggestions how i get my control back to display some content within.

解决方案

The WebBrowser control is a managed wrapper for the ActiveX WebBrowser control, and uses whichever version of the control is installed on the user's computer.

The WebBrowser control cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

The WebBrowser class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your Main method is marked with the STAThreadAttribute attribute.

这篇关于Outlook外接程序-Visual Basic Windows窗体应用程序-WebBrowser控件内容不再显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆