Topic: Google qnd :VD

Hello Matmathou and Dmitry

Mathmatou :

I tested your script to use an application with Google Maps (I made a Contact Manager application).
When I click on a button, I can see the town of my contact displayed into Google).
It works fine.
The code was :
OpenURL('https://www.google.com/maps/place/' + Accueil.Label24.Caption+',+fr+'+Accueil.Label13.Caption);
Label 24 is the town, Label13 is Postal Code.

I tried to go beyond asking Google to display the map with the street directly in my contact.
After some quests into the web, I wrote surch a procedure to do that.
This is the code :

procedure Google_Search(const Adresse : string; const CP : string; const Ville : string);
var URL : string;
begin
  URL := 'http://maps.google.fr/maps?f=q&hl=fr&q=';
  URL := URL + Accueil.Label19.Caption + ' ,+ ' + Accueil.Label13.Caption + '+' + Accueil.Label24.Caption;
  ShellExecute(GetDesktopWindow(), 'open', PChar(URL), nil, nil, SW_SHOWNORMAL);
end;

Here, Label19 is th street where lives my contacts.

When I launch MVD, I get an error message telling : 'Undeclared identifier : ShellExecute'.

As ShellExecute belongs to ShellAPI unit of Windows, I wonder this one is implemented in MVD.

Dmitry, thanks for your answers

JB

Re: Google qnd :VD

Hello,

try this code to show google map in Image

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
    sURL: string;
    sAddress: string;
    sZoom: string;
begin
    sZoom := '17';
    sAddress := 'Brooklyn+Bridge,New+York,NY';
    sURL := 'https://maps.googleapis.com/maps/api/staticmap?center='+sAddress+'&zoom='+sZoom+'&size=600x600&maptype=roadmap';
    HTTPGetFile(sURL, 'googlemaps.png');
    Form1.Image1.Picture.LoadFromFile('googlemaps.png');
end;

Here you can find more info about Google maps static api
https://developers.google.com/maps/docu … maps/intro

Dmitry.