我们有一个用VB6编写的大型系统,系统的一部分使用WebControl向用户展示了一个BING地图。这使用了BING the控件的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中不起作用。
对于如何让WebControl在IDE中运行时使用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发布于 2017-07-14 14:57:52
将以下内容添加到HTML页面的标题中:
<meta http-equiv="x-ua-compatible" content="IE=Edge"/>
这将告诉Web控件使用安装在机器上的最新版本的IE。
https://stackoverflow.com/questions/45100825
复制相似问题