首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用必应网络控制V8的VB6开发环境

使用必应网络控制V8的VB6开发环境
EN

Stack Overflow用户
提问于 2017-07-14 10:34:53
回答 1查看 341关注 0票数 2

我们有一个用VB6编写的大型系统,系统的一部分使用WebControl向用户展示了一个BING地图。这使用了BING the控件的V7。微软反对使用V7控件,因此我试图迁移到V8,但我遇到了一些问题。

Bing WebControl V8需要IE11 (尽管它确实在IE10上工作),但是WebControl默认情况下只使用IE7呈现引擎。您可以通过写入注册表项告诉它使用稍后的引擎(如果可用):

代码语言:javascript
运行
复制
HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\<exe name> REG_DWORD 11000

这在编译程序时很好,但在从VB6 IDE运行时却不起作用,所以调试是一个PITA。我已经在注册表中设置了编译后的EXE名称和VB6.EXE,但是它在VB6中不起作用。

对于如何让WebControl在IDE中运行时使用IE10/11呈现,有什么想法吗?这是在Windows 7上。

编辑

下面是我的代码:将一个WebBrowser控件添加到表单中,称为msIE。

代码语言:javascript
运行
复制
    Option Explicit

Private mstrHTTP As String
Public mstrAPI_Key As String

Private Sub Form_Load()
    Me.Caption = "Name : '" & App.EXEName & "'"

    mstrHTTP = ""
    mstrAPI_Key = "Your BING API key here"

    msIE.Navigate ("about:blank")

    Call BuildFunction(mstrHTTP, "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">")
    Call BuildFunction(mstrHTTP, "<html>")
    Call BuildFunction(mstrHTTP, "    <head>")
    Call BuildFunction(mstrHTTP, "        <meta http-equiv='X-UA-Compatible' content='IE=Edge' />")
    Call BuildFunction(mstrHTTP, "        <title>Load map with navigation bar module</title>")
    Call BuildFunction(mstrHTTP, "        <meta charset='utf-8' />")
    Call BuildFunction(mstrHTTP, "        ")
    Call BuildFunction(mstrHTTP, "        <!-- Reference to the Bing Maps SDK -->")
    Call BuildFunction(mstrHTTP, "        <script type='text/javascript'")
    Call BuildFunction(mstrHTTP, "                src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap'")
    Call BuildFunction(mstrHTTP, "                async defer></script>")
    Call BuildFunction(mstrHTTP, "        ")
    Call BuildFunction(mstrHTTP, "        <script type='text/javascript'>")
    Call BuildFunction(mstrHTTP, "        function GetMap()")
    Call BuildFunction(mstrHTTP, "        {")
    Call BuildFunction(mstrHTTP, "            var map = new Microsoft.Maps.Map('#myMap', {")
    Call BuildFunction(mstrHTTP, "                credentials: '" & mstrAPI_Key & "'")
    Call BuildFunction(mstrHTTP, "                ,enableInertia: false")
    Call BuildFunction(mstrHTTP, "                ,showMapTypeSelector: false")
    Call BuildFunction(mstrHTTP, "                ,showZoomButtons: false")
    Call BuildFunction(mstrHTTP, "                ,showLocateMeButton: false")
    Call BuildFunction(mstrHTTP, "            });")
    Call BuildFunction(mstrHTTP, "        // Add post map load code here")
    Call BuildFunction(mstrHTTP, "        }")
    Call BuildFunction(mstrHTTP, "        </script>")
    Call BuildFunction(mstrHTTP, "    </head>")
    Call BuildFunction(mstrHTTP, "    <body style='margin:0;'>")
    Call BuildFunction(mstrHTTP, "        <div id='myMap' style='width:100%;height:100%;'></div>")
    Call BuildFunction(mstrHTTP, "    </body>")
    Call BuildFunction(mstrHTTP, "</html>")

    msIE.Document.write (mstrHTTP)

End Sub

Private Sub BuildFunction(ByRef theString As String, ByRef extraString As String)
    theString = theString & extraString & vbCrLf
End Sub

Private Sub Form_Resize()
    msIE.Top = 0
    msIE.Left = 0
    msIE.Width = Me.ScaleWidth
    msIE.Height = Me.ScaleHeight
End Sub
EN

回答 1

Stack Overflow用户

发布于 2017-07-14 14:57:52

将以下内容添加到HTML页面的标题中:

<meta http-equiv="x-ua-compatible" content="IE=Edge"/>

这将告诉Web控件使用安装在机器上的最新版本的IE。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45100825

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档