delphi 调用百度地图api

一、调用javascript的方法

     两种:

      第一种:采用自编函数的方法

     

function ExecuteJavaScript(WebBrowser:TWebBrowser; Code: string):Variant;
var //发送脚本
Document:IHTMLDocument2;
Window:IHTMLWindow2;
begin
// execute javascript in webbrowser
Document:=WebBrowser.Document as IHTMLDocument2;
if not Assigned(Document) then Exit;
Window:=Document.parentWindow;
if not Assigned(Window) then Exit;
try
Result:=Window.execScript(Code,'JavaScript');
except
on E:Exception do raise Exception.Create('Javascript error '+E.Message+' in: '#13#10+Code);
end;
end;

 

第二种:直接调用WebBrowser内置方法:

    WebBrowser1.OleObject.document.parentWindow.方法名();

 

二、百度API的调用

     制作一个HTML文件

     






百度地图测试







你可能感兴趣的:(数据库管理,地图应用,Delphi)