我们有一个用VB6编写的大型系统,系统的一部分使用WebControl向用户呈现BING映射。这是使用BING webcontrol的V7。微软已弃用V7控件,所以我试图迁移到V8,但我遇到了一些问题。
Bing WebControl V8需要IE11(虽然它可以在IE10上运行),但WebControl默认只使用IE7渲染引擎。您可以通过编写注册表项来告诉它使用更高版本的引擎(如果可用):
HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\<exe name> REG_DWORD 11000
编译程序时工作正常,但从VB6 IDE运行时不起作用,因此调试是PITA。我已经在注册表中设置了已编译的EXE名称和VB6.EXE,但它在VB6中不起作用。
关于在IDE中运行时如何让WebControl使用IE10 / 11渲染的任何想法?这是在Windows 7顺便说一句。
修改的
这是我的代码: 将WebBrowser控件添加到窗体,称之为msIE。
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
答案 0 :(得分:0)
将以下内容添加到HTML页面的标题中:
<meta http-equiv="x-ua-compatible" content="IE=Edge"/>
这将告诉Web Control使用计算机上安装的最新版本的IE。