The code is as follows:
vc + + program: (only in OnInitDialog () to add a few lines of code, to do the test)
//TODO: add additional initialization code in the
CHAR szPath [255].//path
Memset (szPath, 0, sizeof (char) * 255);//path reset
GetCurrentDirectory (255, szPath);//get the current directory
StrCat (szPath, \ \ "Google - earth. HTML");
M_webBrower. SetSilent (TRUE);//ban pop-up script errors
M_webBrower. Navigate (szPath, NULL, NULL, NULL, NULL);
HTML code (derived from the network) :
& lt; ! PUBLIC DOCTYPE HTML "-///DTD/W3C XHTML 1.0 Strict//EN"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" & gt;
<meta HTTP - equiv="content-type" content="text/HTML. Charset=gb2312 "/& gt;
<script SRC="http://ditu.google.cn/maps? The file=api& amp; V=2 & amp; amp; Key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1 m51RBrvYughuyMxQ - i1QfUnH94QxWIa6N4U6MouMmBA & amp; Hl=useful - CN "type=" text/javascript "& gt; </script>
{
If (GBrowserIsCompatible ())//if the browser supports Google map
{
The map=new GMap2 (document. GetElementById (" map_canvas "));//define a map variables, without the var keyword that is a global variable
Map. SetCenter (new GLatLng (22.536, 113.956), 14);//set the initial center and zoom level
//map. OpenInfoWindow (map) getCenter (), the document. The createTextNode (" Hello, world "));//display a bubble
Map. AddControl (new GLargeMapControl ());//increase large scale article
//map. AddControl (new GSmallMapControl ());//add article small scale
Map. AddControl (new GMapTypeControl ());//increase map type switch button
Var point=new GLatLng (22.536, 113.956);//generates a coordinate point
Map. AddOverlay (new GMarker (point));//add a map marker
//GEvent. AddListener (map, "click", function () {alert (" click map "); });//register click event listener, set the response function
}
}
</script>
{
Alert (" this is alert function of JS ");
//map. PanTo (new GLatLng (39.927, 116.407));//jump to the specified coordinates to the
}
</script>
{
//alert (LNG);//test parameters are passed
//var longi=parseFloat (LNG);//afterwards just know, don't have to type conversion, javascript can automatically convert
//var lati=parseFloat (lat);
Map. PanTo (new GLatLng (lat and LNG));
}
</script>