Solved

Using Google maps with Postcode field from Delphi

Posted on 2007-11-26
4
1,029 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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, DigitalPersona Fingerprint reader and MySQL 6 334
error 1.1 400 Bad request idhttp delphi 18 148
Delphi selector screen 2 84
Delphi...Split view - idea? 1 90
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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