Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Google Map Joiner

3.32/5 (7 votes)
20 Dec 2007CPOL 1   592  
Merge some small print-screen maps to a big one
Screenshot -

Introduction

This code uses the mouse's move and drag events to move Google map, then copy the map of the current-screen, finally merge them to a big one.

Background

When I have to go to another city, I always need the help of maps. Because my mobile cannot access the Web when I travel, I always collect the Google map, then merge it into one big map, and put it into my mobile. The code I discuss below does the task.

Using the Code

First, open Google Map, select a place you want to copy.

Second, move the mouse to the left-top point of the useful map, then stop for two seconds; the code will remember the left-top point.

Third, move the mouse to the right-bottom point of the useful map, then stop for two seconds; the code will remember the right-bottom point.

Screenshot - example.JPG

Fourth, select how big the map will be. The code will copy the map as shown in the following picture. The current screen will be centered.

Screenshot - example.JPG

Finally, click start.

The mouse move code looks like this:

C#
[DllImport("user32.dll")]
static extern bool SetCursorPos(int x, int y);

[DllImport("user32.dll")]
static extern void mouse_event
    (uint mouseEvent, int dx, int dy, uint data, int extrainfo);

SetCursorPos(x1, y1);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Thread.Sleep(500);
SetCursorPos(x2, y2);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

History

  • 15th December, 2007: Initial version
  • 21st December, 2007: Updated to delete Temp folder

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)