Solved

Using Google maps with Postcode field from Delphi

Posted on 2007-11-26
4
1,031 Views
Last Modified: 2014-07-18
Hi Experts,

I have an application which contains a postcode.
What I need to do is to have a button called "Get Directions" for example and Click on it and search google Maps for the Postcode on the TEdit and open it in the browser.

I know it's possible but I just don't know how to do it!

Hope you can help!

Thanks

ST3VO
 
0
Comment
Question by:ST3VO
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
Steven-Fernandez earned 500 total points
ID: 20349672
Here you are.

This is an example where you insert the postcode on a TEdit Component.

Don't forget to add the "ShellAPI" unit to uses.


procedure TForm1.Button1Click(Sender: TObject);
 var s: string;
begin
s:=('http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q='+Edit1.text+'+&ie=UTF8&z=16&iwloc=addr&om=1');
ShellExecute(self.WindowHandle,'open',PChar(s),nil,nil, SW_SHOWNORMAL);
end;

Open in new window

0
 

Author Comment

by:ST3VO
ID: 20349680
Perfect!!!

Thanks a million!!!

ST3VO
0
 

Author Closing Comment

by:ST3VO
ID: 31410951
Perfect!!!
0
 

Expert Comment

by:Delphiwizard
ID: 40203973
Code from Steven Fernandez can now be changed to:
uses ShellAPI;

procedure TForm1.Button1Click(Sender: TObject);
var s : string;
begin
  s := ('https://www.google.nl/maps/place/' + Edit1.text);
  ShellExecute(self.WindowHandle,'open',PChar(s),nil,nil, SW_SHOWNORMAL);
end;

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 189
When i run adoquery my application freezes 26 190
Delphi, TImage, Png 2 26
how can i delete one control based on its tagstring ? 6 36
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question