Solved

Using Google maps with Postcode field from Delphi

Posted on 2007-11-26
4
1,025 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
Comment Utility
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
Comment Utility
Perfect!!!

Thanks a million!!!

ST3VO
0
 

Author Closing Comment

by:ST3VO
Comment Utility
Perfect!!!
0
 

Expert Comment

by:Delphiwizard
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now