Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Grab Google Maps Corner Coordinates and Image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PBWin Grab Google Maps Corner Coordinates and Image

    This program grabs the Google Maps corner coordinates and its image.

    Although the code looks fairly straight forward it has been a long and tedious process of finding the correct working (!) code; a lot of trial and even more error.

    References to PB-forum discussions on several topics are given in the header of the code.

    Code:
    ' Grab Google Maps Corner Coordinates and Image
    '
    ' October 2, 2016 by Henk Spoelstra
    '
    ' Based on example from Dean Goodman:
    ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/53945-google-earth-by-using-cwindow
    '
    ' Code from José Roca for the Webbrowser Control:
    ' https://forum.powerbasic.com/forum/jose-s-corner/source-code-ab/50858-using-cwindow-to-embed-the-webbrowser-control?p=601436#post601436
    '
    ' Code from Gary Beene/José Roca for retrieving Webbrowser Events with CLASS CDWebBrowserEvents2:
    ' https://forum.powerbasic.com/forum/jose-s-corner/discussion/747425-get-text-from-table-cell?p=747484#post747484
    '
    ' Code from José Roca to use the METHOD DocumentComplete instead of DownloadComplete:
    ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/753161-addwebbrowsercontrol-fires-three-times-with-pwbevents
    '
    ' Other references "how-to" from the internet are shown in the code
    '
    ' Sizes of the Dialog window and Google map may be adjusted by changing the values in this code.
    ' Google Map does not size with the Dialog window. This should be programmed by yourself.
    '
    ' The grabbed Google Map can be stored by right clicking on the pop-up window.
    ' For high resolution images consult: https://developers.google.com/maps/documentation/static-maps/intro
    '
    ' The corner coordinates are obtained in the METHOD onclick
    ' and further processed in the SUB-routine Process_Googlemap in which also
    ' the image is captured
    '
    ' The display of the image window and handling should be tailored to your own application
    '
    #COMPILE EXE
    #DIM ALL
    %UNICODE = 1
    %USEWEBBROWSER = 1
    %USEOLECON = 1                ' // Use the OLE container
    #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
    #INCLUDE ONCE "MSHTML.INC"    ' // MSHTML
    
    %IDC_WEBBROWSER           = 1001    'Handle for the Webbrowser with the Google Map
    %IDC_CapImg               = 1002    'Handle for the window with the Google map image
    
    FUNCTION PBMAIN  '---------- PBMAIN
    
      ' // Create an instance of the class
      GLOBAL pWindow AS IWindow
    
      pWindow = CLASS "CWindow"
      IF ISNOTHING(pWindow) THEN EXIT FUNCTION
    
      ' // Initialize lat/lon as center point for the map
      LOCAL C_Lng, C_Lat AS DOUBLE                    'Center coordinates for the initial Google Map
      LOCAL Zoom AS LONG                              'Zoom for the initial Google Map
      C_Lng= -85.9517238890354
      C_Lat= 40.1265386298385
      Zoom = 18                                       'Set amount of zoom of the Google Map
    
      ' // Set size of DIALOG, Browser and Google map
      LOCAL   xSzDlg  , ySzDlg   AS LONG             'Width and height of the Dialog window
      GLOBAL  xSzMap  , ySzMap   AS LONG             'x-size (width) and y-size (height)of the map in the browser window (is needed in the Javascript and in the SUB Process_GoogleMap)
      xSzDlg=700                 : ySzDlg=700        'Set the x-size (width) and y-size (height) of the Dialog window
      xSzMap  = xSzDlg* 0.9                          'Calculate x-size (width)  of the map in the Browser window. Is used in the Javascript
      ySzMap  = ySzDlg*0.78                          'Calculate y-size (height) of the map in the Browser window. Is used in the Javascript
    
      ' // Design of the Javascript code for retrieving the Google Map Corner Coordinates
      DIM s AS WSTRING
      s = "<!DOCTYPE html>"           'The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly.
                                      'It must only appear once, at the top of the page (before any HTML tags).
      s +="<html>"'& $CRLF            'The <html> element is the root element of an HTML page
      s +="<head>"'& $CRLF            'The <head> element contains meta information about the document
      s +="<script"& $CRLF            '1st script
      s +="src='http://maps.googleapis.com/maps/api/js'>"& $CRLF    'invoke googleapi maps
      s +="</script>" & $CRLF
      s +="</head>"& $CRLF
    
      s +="<script>"& $CRLF           '2nd script
      s += "var map;"& $CRLF
      s += "function initialize() "& $CRLF    'Set map parameters
      s += "{"& $CRLF
      s +=    "var mapOpt = {"& $CRLF
      s +=                   " center:new google.maps.LatLng(" & FORMAT$(C_Lat) & "," & FORMAT$(C_Lng) & "),"& $CRLF
      s +=                   " zoom:"& LTRIM$(STR$(Zoom)) & ","& $CRLF
      s +=                   " mapTypeId:google.maps.MapTypeId.SATELLITE "& $CRLF
      s +=                " };"& $CRLF
      s +=    "map=new google.maps.Map(document.getElementById('googleMap'),mapOpt); "& $CRLF      'Make map with settings ('googleMap' is defined further on under the <body> tag)
      s +=    "google.maps.event.addDomListener(map, 'center_changed' , function() "& $CRLF        'addDOMLIsterner must be placed here under the function "initialize" otherwise it won't work
      s +=    "{" & $CRLF
      s +=      "var bounds = map.getBounds();"  & $CRLF  ' http://stackoverflow.com/questions/6910847/get-boundaries-longitude-and-latitude-from-current-zoom-google-maps
      s +=      "var ne = bounds.getNorthEast();"& $CRLF  ' LatLng of the north-east corner
      s +=      "var sw = bounds.getSouthWest();"& $CRLF  ' LatLng of the south-west corder
      s +=      "document.getElementById('ne').value = ne;"& $CRLF   '.value is needed here instead of .innerHTML see: http://www.w3schools.com/js/tryit.asp?filename=tryjs_function_return
      s +=      "document.getElementById('sw').value = sw;"& $CRLF
      s +=    "});"& $CRLF
      s += "}"
      s +="</script>"& $CRLF
    
      s +="<script>" & $CRLF          '3rd script
         s +="function getCorners() "& $CRLF 'Make a "Grab Coordinates"-button and only when clicking this button the coordinates are grabbed.
         s +="{" & $CRLF
         s +=  "var bounds = map.getBounds();"& $CRLF       'http://stackoverflow.com/questions/6910847/get-boundaries-longitude-and-latitude-from-current-zoom-google-maps
         s +=  "var ne_c = bounds.getNorthEast(); "& $CRLF  ' Get LatLng of the north-east corner
         s +=  "var sw_c = bounds.getSouthWest();"& $CRLF   ' Get LatLng of the south-west corder
         s +=  "document.getElementById('ne_coord').value = ne_c;"& $CRLF
         s +=  "document.getElementById('sw_coord').value = sw_c;"& $CRLF
         s +=  "var zm = map.getZoom();"& $CRLF             ' Get the actual zoom
         s +=  "document.getElementById('zoom').value = zm;"& $CRLF
      s +="}" & $CRLF
      s +="</script>"& $CRLF
    
      s +="<script>"& $CRLF           '4th script                                     'https://www.w3.org/TR/DOM-Level-2-Events/events.html
      s += "google.maps.event.addDomListener(window, 'load', initialize); "& $CRLF    'see https://developers.google.com/maps/documentation/javascript/events   Topic "Listening to DOM Events"
      s +="</script>"& $CRLF                                                          'or   https://developers.google.com/maps/documentation/javascript/examples/event-domListener
                                                                                      'or tutorial http://www.w3schools.com/js/js_htmldom.asp  for more info on DOM
      s +="<body>"& $CRLF
      s +="<div id='googleMap' style='width:" & LTRIM$(STR$(xSzMap)) & "px;height:" & LTRIM$(STR$(ySzMap)) & "px;margin-left:0px;margin-top:0px'></div>"& $CRLF
      s +="<br>"& $CRLF
      s +="<input type='text' id='ne' name='ne' size='75' value='ne'>"& $CRLF   'https://www.experts-exchange.com/questions/28499086/Visual-Studio-2013-Get-latitude-Longitude-from-google-Map-in-windows-project.html#answer40294233
      s +="<input type='text' id='sw' name='sw' size='75' value='sw'>"& $CRLF
      s +="<input type='button' id='Grab coordinates' name='button' value='Grab coordinates' onclick='getCorners()'>"& $CRLF    'MUST BE ONCLICK AS IN THE "CLASS CHTMLDocumentEvents2" THE METHOD is defined as ONCLICK !!!
      s +="<br>"& $CRLF
      s +=" <input type='hidden'   id='ne_coord' name='ne_result' size='75' value='ne-coordinates'>"& $CRLF
      s +=" <input type='hidden'   id='sw_coord' name='sw_result' size='75' value='sw-coordinates'>"& $CRLF
      s +=" <input type='hidden'   id='zoom'     name='zm'        size='20' value='zoom'>"& $CRLF
      s +="</body> "& $CRLF
      s +="</html> "& $CRLF
    
      ' // Save the Javascript as a temporary file
      LOCAL bstrTempFileName   AS WSTRING
      bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
    
      ' // Set the CLASS for capturing EVENTS in the Webbrowser
      LOCAL pWBEvents      AS DWebBrowserEvents2Impl
      pWBEvents = CLASS "CDWebBrowserEvents2"
    
      ' // Create the Dialog/WebBrowser control with the embedded map
      GLOBAL hDlg  AS DWORD               'Reference to Dialog window (which is the webbrowser window)
      DIALOG NEW PIXELS, 0, "PB with Webbrowser", , , xSzDlg,ySzDlg, %WS_OVERLAPPEDWINDOW TO hDlg               'Make Dialog window
      pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, pWBEvents, 0, 0, xSzDlg, ySzDlg)    'AddWebBrowserControl is a METHOD defined in CWindow.INC
                                                                                                                'pWBEvents is a call to the Events
      '// Show Dialog and start the Callback Processor
      DIALOG SHOW MODAL hDlg, CALL DlgProc
    
    END FUNCTION '---------- END PBMAIN
    
    
    ' ========================================================================================
    ' Main Dialog CALLBACK procedure
    ' ========================================================================================
    CALLBACK FUNCTION DlgProc() AS LONG
    
    SELECT CASE CB.MSG
    CASE %WM_INITDIALOG
         DIALOG ENABLE hDlg
    
    'CASE %WM_COMMAND
    ' SELECT CASE AS LONG CB.CTL
    '   CASE %IDC_BUTTON
    '     IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
    '      MSGBOX "CLICK"
    '     END IF
    
    ' ...
    'END SELECT
    CASE %WM_SIZE
    IF CB.WPARAM <> %SIZE_MINIMIZED THEN
    '
    ' When RESIZING the browser window. The Google Map size stays the same.
    ' If the Google Map need to be resized as well then teh Javascript must be run again.
    '
    
    END IF
    CASE %WM_DESTROY
    hdlg=0
    END SELECT
    
    END FUNCTION
    ' ========================================================================================
    
    
    
    ' ########################################################################################
    ' Class CDWebBrowserEvents2
    ' Interface name = DWebBrowserEvents2
    ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
    ' Web Browser Control events interface
    ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
    ' ########################################################################################
    
    CLASS CDWebBrowserEvents2 GUID$("{700B73A2-CCFC-4FE0-B9AC-D5853D71B7B9}") AS EVENT
    
       INSTANCE pIWebBrowser2 AS IWebBrowser2
       INSTANCE pHTMLDocumentEvents2 AS HTMLDocumentEvents2Impl
    
       ' =====================================================================================
       CLASS METHOD DESTROY
          ' Disconnect events
          IF ISOBJECT(pHTMLDocumentEvents2) THEN EVENTS END pHTMLDocumentEvents2
       END METHOD
       ' =====================================================================================
    
    ' ========================================================================================
    ' Implementation of the interface
    ' ========================================================================================
    INTERFACE DWebBrowserEvents2Impl GUID$("{34A715A0-6587-11D0-924A-0020AFC7AC4D}") AS EVENT
    
      INHERIT IDISPATCH
    
       ' =====================================================================================
       ' Note (October 2, 2016):
       ' The METHOD DocumentComplete has been placed here as the original METHOD DownloadComplete
       ' fires three times. See:
       ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/753161-addwebbrowsercontrol-fires-three-times-with-pwbevents
       ' However the DocumentComplete does not fire when the Webbrowser is not visible.
       ' See: BUG: DocumentComplete Does Not Fire When WebBrowser Is Not Visible
       ' http://support.microsoft.com/kb/q259935/
       ' =====================================================================================
        METHOD DocumentComplete <259> ( _
         BYVAL pDisp AS IDISPATCH _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       )                                                    ' void
    
          ' Get a reference to the IHTMLDocument2 interface
          LOCAL pHTMLDocument2 AS IHTMLDocument2
          pHTMLDocument2 = pIWebBrowser2.Document
          IF ISNOTHING(pHTMLDocument2) THEN EXIT METHOD
          ' Connect to the events fired by the page
          pHTMLDocumentEvents2 = CLASS "CHTMLDocumentEvents2"
          IF ISNOTHING(pHTMLDocumentEvents2) THEN EXIT METHOD
          EVENTS FROM pHTMLDocument2 CALL pHTMLDocumentEvents2
    
      END METHOD
       ' =====================================================================================
    
       ' =====================================================================================
       METHOD BeforeNavigate2 <250> ( _
         BYVAL pDisp AS IDISPATCH _                         ' __in IDispatch* pDisp
       , BYREF vURL AS VARIANT _                            ' __in VARIANT* URL
       , BYREF vFlags AS VARIANT _                          ' __in VARIANT* Flags
       , BYREF vTargetFrameName AS VARIANT _                ' __in VARIANT* TargetFrameName
       , BYREF vPostData AS VARIANT _                       ' __in VARIANT* PostData
       , BYREF vHeaders AS VARIANT _                        ' __in VARIANT* Headers
       , BYREF bCancel AS INTEGER _                         ' __in_out VARIANT_BOOL* Cancel
       )                                                    ' void
    
          ' Get a reference to the WebBrowser control
          IF ISNOTHING(pIWebBrowser2) THEN pIWebBrowser2 = pDisp
          IF ISNOTHING(pIWebBrowser2) THEN EXIT METHOD
          ' If there was a previous loaded page, disconnect from the events
          IF ISOBJECT(pHTMLDocumentEvents2) THEN
             EVENTS END pHTMLDocumentEvents2
             pHTMLDocumentEvents2 = NOTHING
          END IF
    
       END METHOD
       ' =====================================================================================
    
    END INTERFACE
    
    END CLASS
    ' ########################################################################################
    
    
    ' ########################################################################################
    ' Class CHTMLDocumentEvents2
    ' Interface name = HTMLDocumentEvents2
    ' IID = {3050F613-98B5-11CF-BB82-00AA00BDCE0B}
    ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
    ' ########################################################################################
    
    CLASS CHTMLDocumentEvents2 GUID$("{1FFB0071-8BCC-4BBD-BC29-A662FAE87C82}") AS EVENT
    
    INTERFACE HTMLDocumentEvents2Impl GUID$("{3050F613-98B5-11CF-BB82-00AA00BDCE0B}") AS EVENT
    
      INHERIT IDISPATCH
    
       ' =====================================================================================
       METHOD onclick <-600> ( _
         BYVAL pEvtObj AS IHTMLEventObj _                   ' __in IHTMLEventObj* pEvtObj
       )                                                    ' void
    
          LOCAL pElement AS IHTMLElement           ' // Element that has fired the event
          LOCAL pHTMLDocument2 AS IHTMLDocument2   ' // Document object
          LOCAL bstrId AS WSTRING                  ' // Identifier of the element that has fired the event
          LOCAL bstrValue AS WSTRING               ' // Value of the property
    
          ' // Get a reference to the element that has fired the event
          IF ISOBJECT(pEvtObj) THEN pElement = pEvtObj.srcElement
          IF ISNOTHING(pElement) THEN EXIT METHOD
    
          ' // Get a reference to the IHTMLDocument2 interface
          pHTMLDocument2 = pElement.document
          IF ISNOTHING(pHTMLDocument2) THEN EXIT METHOD
    
          ' // Get the identifier of the element that has fired the event
          bstrId = pElement.id
          'MSGBOX bstrId
    
          LOCAL NE_Coord_STR AS STRING                  'Grabbed NE Coordinates as string
          LOCAL SW_Coord_STR AS STRING                  'Grabbed SW Coordinates as string
          LOCAL Zoom_STR AS STRING                      'Grabbed Zoom as string
    
          SELECT CASE bstrId
             'MSGBOX bstrId
             CASE "Grab coordinates"
             bstrValue = IHTMLDocument_getElementValueById(pHTMLDocument2, "ne_coord")
             NE_Coord_STR=bstrValue
             bstrValue = IHTMLDocument_getElementValueById(pHTMLDocument2, "sw_coord")
             SW_Coord_STR=bstrValue
             bstrValue = IHTMLDocument_getElementValueById(pHTMLDocument2, "zm")
             Zoom_STR=bstrValue
             CALL Process_GoogleMap(NE_Coord_STR,SW_Coord_STR,Zoom_STR)
          END SELECT
    
       END METHOD
       ' =====================================================================================
    
    END INTERFACE
    
    END CLASS
    ' ########################################################################################
    
    
    
    '---------------- SUB Process_GoogleMap
    '
    ' Retrieves lat/lng from string coordinates
    ' Grabs the GoogleMap image
    '
    SUB Process_GoogleMap(BYVAL NE_Coord_STR AS STRING, BYVAL SW_Coord_STR AS STRING, BYVAL Zoom_STR AS STRING)
    
      LOCAL CommaPos AS LONG
      LOCAL NE_LatStr, NE_LngStr, SW_LatStr, SW_LngStr AS STRING
      LOCAL NE_Lat, NE_lng, SW_Lat, SW_Lng AS DOUBLE
    
      CommaPos  = INSTR(NE_Coord_STR, ",")         'Find the comma in the string
      NE_LatStr = LEFT$(NE_Coord_STR,Commapos-1)   'Take the left portion up to the comma
      NE_Lat    = VAL(MID$(Ne_LatStr,2,LEN(NE_LatStr)))
    
      NE_LngStr = RIGHT$(NE_Coord_STR,Commapos)    'Take the right portion from the comma to the end
      NE_Lng    = VAL(MID$(Ne_LngStr,1,LEN(NE_LngStr)-1))
    
      SW_LatStr = LEFT$(SW_Coord_STR,Commapos-1)   'Take the left portion up to the comma
      SW_Lat    = VAL(MID$(SW_LatStr,2,LEN(SW_LatStr)))
    
      SW_LngStr = RIGHT$(SW_Coord_STR,Commapos)    'Take the right portion from the comma to the end
      SW_Lng    = VAL(MID$(SW_LngStr,1,LEN(SW_LngStr)-1))
    
      ' // Google Map position stays the same when the Dialog is enlarged (in this version of the program).
      ' // Calculate center of the map  (Center coordinates needed to grab the image)
      LOCAL C_Lat, C_Lng AS DOUBLE
    
      C_Lat=(SW_Lat+NE_Lat)/2
      C_Lng=(SW_Lng+NE_Lng)/2   'For Lng around +180/-180 another calculation is needed (not implemented yet)
    
      ' // Define and set size of captured image window
      LOCAL xPosCapImg, yPosCapImg, xSzCapImg, ySzCapImg AS LONG
    
      xPosCapImg=0            'x position of the captured image
      yPosCapImg=0            'y position of the captured image
      xSzCapImg=1.1*xSzMap    'x-size (width)  of the captured image window. Factor 1.1 just taken to show the image inside the popup window
      ySzCapImg=1.1*ySzMap    'y-size (height) of the captured image window
    
      'Make a Javascript for catching a static Google Map
      LOCAL s AS WSTRING
      s +="<!DOCTYPE html>"   'Script from   https://seydahatipoglu.wordpress.com/2012/10/26/export-google-map-to-image/
      s +="<html>"& $CRLF
      s +="<head runat='server'>"& $CRLF
      s +="</head>"& $CRLF
      s +="<body>"& $CRLF
      s +="<script>"& $CRLF                '1st script
      s +="function refreshMapUrl()"& $CRLF
      s +="{"& $CRLF
      s +=  "var mapImage = document.getElementById('imgMap');"& $CRLF
      s +=  "var mapUrl = 'http://maps.googleapis.com/maps/api/staticmap?"   'See for options: https://developers.google.com/maps/documentation/static-maps/intro
      s +=  "center=" & FORMAT$(C_Lat) & "," & FORMAT$(C_Lng)  &"&"
      s +=  "zoom=" & Zoom_STR & "&"
      s +=  "size=" & FORMAT$(xSzMap) & "x" & FORMAT$(ySzMap)&"&"
      s +=  "&maptype=satellite&"
      s +=  "sensor=false';"& $CRLF
      s +=  "mapImage.src=mapUrl;"& $CRLF
      s +="}"& $CRLF
      s +="</script>"& $CRLF
      s +="<img alt='' src='' id='imgMap'  />"& $CRLF
      s +="<script>"& $CRLF              '2nd script calls the defined function in the 1st script
      s +="refreshMapUrl();"& $CRLF
      s +="</script>"& $CRLF
      s +="</body>"& $CRLF
      s +="</html>"& $CRLF
    
     ' // Save the Javascript for grabbing the image as a temporary file
      LOCAL bstrTempFileName   AS WSTRING
      bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
    
      '//Create popup window with the grabbed Google Map image
      DIM hImg AS GLOBAL DWORD          'Handle for the image window (is used in the CALLBACK and SUB Process_Googlemap
    
      DIALOG NEW PIXELS, hImg, "Grabbed Google Map image",-10 ,10 , xSzCapImg,ySzCapImg, %WS_CAPTION OR %WS_SYSMENU TO hImg       'Make Captured Image window
      pWindow.AddWebBrowserControl(hImg, %IDC_CapImg , bstrTempFileName, NOTHING, 0, 0, xSzCapImg, ySzCapImg)    'AddWebBrowserControl is a METHOD defined in CWindow.INC
    
      DIALOG SHOW MODAL hImg, CALL DlgProc           'Show Dialog and start the Callback Processor
    
    END SUB  '---------------- END Process_GoogleMap
    
    
    
    ' ========================================================================================
    ' Image CALLBACK procedure (not used)
    ' ========================================================================================
    CALLBACK FUNCTION ImgProc() AS LONG
    
    SELECT CASE CB.MSG
    CASE %WM_INITDIALOG
    
    
    CASE %WM_COMMAND
     SELECT CASE AS LONG CB.CTL
    '   CASE %IDC_BUTTON
    '     IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
    '      MSGBOX "CLICK"
    '     END IF
    
    
    ' ...
    END SELECT
    'CASE %WM_SIZE
    'IF CB.WPARAM <> %SIZE_MINIMIZED THEN
    '  LOCAL xSzDlgNew, ySzDlgNew AS LONG
    '  DIALOG GET CLIENT CB.HNDL TO xSzDlgNew, ySzDlgNew
     ' CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, xSzBrowNew, ySzBrowNew
    'END IF
    CASE %WM_DESTROY
    PostQuitMessage 0
    END SELECT
    
    END FUNCTION
    ' ========================================================================================

    #2
    Thanks Henk , would be better if this program can center the Map at the actual location (longitude and latitude) of the computer which runs this program.

    Comment


      #3
      Hi... .Just a note that the compliant example above that Henk posted - as of today - a message box from Google in the map browser that the current browser is not supported by Google Maps and it says consider changing browsers... About 3 weeks ago this message started to appear over the Google Map, and you could dismiss it and still grab the screen. But starting today, the Google Map does not come up at all and just the message box on the non-supported browser... I tried on multiply computers as have my software users as well as with different browsers... I tried with the default browser MS Edge and with Google Chrome as the default but to no avail.... Google says that Edge is a compatible browser....Any help would be appreciated... I am less than a novice when it comes to browser calls etc... thx...

      Comment


        #4
        This is my original DDT example with three added lines to get it working. The rest is uo to you.

        Code:
        #COMPILE EXE
        #DIM ALL
        %UNICODE = 1
        
        ' // Include files for external files
        %USEWEBBROWSER = 1            ' // Use the WebBrowser control
        #INCLUDE ONCE "CWindow.inc"   ' // CWindow class
        
        ' // Identifier
        %IDC_WEBBROWSER = 1001
        
        ' ########################################################################################
        ' Main
        ' ########################################################################################
        FUNCTION PBMAIN
        
           ' // Create the dialog
           LOCAL hDlg AS DWORD
           DIALOG NEW PIXELS, 0, "Google Map", , , 700, 400, %WS_OVERLAPPEDWINDOW TO hDlg
        
           ' // Create an instance of the class
           LOCAL pWindow AS IWindow
           pWindow = CLASS "CWindow"
           IF ISNOTHING(pWindow) THEN EXIT FUNCTION
        
           ' // Build the html script
           LOCAL s AS WSTRING
           LOCAL cx, cy AS DOUBLE
           LOCAL zoom AS LONG
           cx = 39.47#
           cy = 0.28#
           zoom = 7
        
           s  = "<!DOCTYPE html>" & $CRLF
           s += "<html>" & $CRLF
           s += "<head>" & $CRLF
           s += "<meta name='viewport' content='initial-scale=1.0, user-scalable=no' />" & $CRLF
        
           s += "      <meta http-equiv='X-UA-Compatible' content='IE=edge'>"   '--> added: used Edge browser
           s += "      <meta http-equiv='MSThemeCompatible' content='Yes'>"     '--> added: allow visual styles
        
           s += "<style type='text/css'>" & $CRLF
           s += "html { height: 100% }" & $CRLF
           s += "  body { height: 100%; margin: 0px; padding: 0px }" & $CRLF
           s += "  #map_canvas { height: 100% }" & $CRLF
        
           s += "         .infomsg {display:none;}"                            '--> added: workaround to ignore the message
        
           s += "</style>" & $CRLF
           s += "<script type='text/javascript'" & $CRLF
           s += "    src='http://maps.google.com/maps/api/js?sensor=false'>" & $CRLF
           s += "</script>" & $CRLF
           s += "<script type='text/javascript'>" & $CRLF
           s += "  function initialize() {" & $CRLF
           s += "    var latlng = new google.maps.LatLng(" & FORMAT$(cx) & "," & FORMAT$(cy) & ");" & $CRLF
           s += "    var myOptions = {" & $CRLF
           s += "      zoom: " & FORMAT$(zoom) & "," & $CRLF
           s += "      center: latlng," & $CRLF
           s += "      mapTypeId: google.maps.MapTypeId.ROADMAP" & $CRLF
           s += "    };" & $CRLF
           s += "    var map = new google.maps.Map(document.getElementById('map_canvas')," & $CRLF
           s += "        myOptions);" & $CRLF
           s += "  }" & $CRLF
           s += "</script>" & $CRLF
           s += "</head>" & $CRLF
           s += "<body scroll='no' onload='initialize()'>" & $CRLF
           s += "  <div id='map_canvas' style='width:100%; height:100%'></div>" & $CRLF
           s += "</body>" & $CRLF
           s += "</html>" & $CRLF
        
           ' // Save the script as a temporary file
           LOCAL bstrTempFileName AS WSTRING
           bstrTempFileName = AfxSaveTempFile(s, "", "TMP", "html", 1)
        
           ' // Create the WebBrowser control with the embedded map
           LOCAL nWide, nHigh AS LONG
           DIALOG GET CLIENT hDlg TO nWide, nHigh
           pWindow.AddWebBrowserControl(hDlg, %IDC_WEBBROWSER, bstrTempFileName, NOTHING, 0, 0, nWide, nHigh)
        
           ' // Display and activate the dialog
           DIALOG SHOW MODAL hDlg, CALL DlgProc
        
        END FUNCTION
        ' ########################################################################################
        
        ' ========================================================================================
        ' Main Dialog procedure
        ' ========================================================================================
        CALLBACK FUNCTION DlgProc() AS LONG
        
           SELECT CASE CBMSG
        
              CASE %WM_COMMAND
                 SELECT CASE CB.CTL
                    ' ...
                    ' ...
                 END SELECT
        
              CASE %WM_SIZE
                 IF CB.WPARAM <> %SIZE_MINIMIZED THEN
                    ' // Resize the control
                    LOCAL nWide, nHigh AS LONG
                    DIALOG GET CLIENT CB.HNDL TO nWide, nHigh
                    CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, nWide, nHigh
                 END IF
        
           END SELECT
        
        END FUNCTION
        ' ========================================================================================
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


          #5
          Hi Jose,

          Thank you for taking the time to provide a fix... It is much appreciated....

          Interestingly, to avoid the message box not appearing I had to modify with just 2 lines in my application. The third line you had with the <style> brackets on each side still showed the message box but the map came up fine... .But it is working now. I was also working with Henk Spoelstra and he had the second line below that I have but without the carriage return to work on his computer... It is a mystery, but all is working now.... Thanks again ....Dean


          s +="<meta http-equiv='X-UA-Compatible' content='IE=edge'>"
          s += " <style>.infomsg {display:none;}</style>" & $CRLF




          Comment


            #6
            Anne,
            Thanks Henk , would be better if this program can center the Map at the actual location (longitude and latitude) of the computer which runs this program.

            You can do that. You just need to know your exact decimal LAT and LON coordinates. Plug them in and away you go. Ha Ha

            For those of you that are looking for the way to modify Henks code. Here is what you do.
            Add these lines:

            Code:
              s += "      <meta http-equiv='X-UA-Compatible' content='IE=edge'>"   '--> added: used Edge browser
              s += "      <meta http-equiv='MSThemeCompatible' content='Yes'>"     '--> added: allow visual styles
            after this line:

            Code:
            s +="<head>"'& $CRLF
            Very Cool Guys. Thank you all.

            Comment


              #7
              Updated to give the location Latitude and Longitude at the center of the screen.
              The initial location is preselected for John Glenn International



              Code:
              [COLOR=007F00]' Grab Google Maps Corner Coordinates and Image
              
              ' Modified by: Jim Fritts on 27 NOV 2017 to provide image center Latitude and Longitude.
              ' also made improvements. See 'Start These statements have changed.
              ' The initial location is plugged in here:
              '  C_Lat=
              '  C_Lng=
              '
              ' October 2, 2016 by Henk Spoelstra
              '
              ' Based on example from Dean Goodman:
              ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/53945-google-earth-by-using-cwindow
              '
              ' Code from José Roca for the Webbrowser Control:
              ' https://forum.powerbasic.com/forum/jose-s-corner/source-code-ab/50858-using-cwindow-to-embed-the-webbrowser-control?p=601436#post601436
              '
              ' Code from Gary Beene/José Roca for retrieving Webbrowser Events with CLASS CDWebBrowserEvents2:
              ' https://forum.powerbasic.com/forum/jose-s-corner/discussion/747425-get-text-from-table-cell?p=747484#post747484
              '
              ' Code from José Roca to use the METHOD DocumentComplete instead of DownloadComplete:
              ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/753161-addwebbrowsercontrol-fires-three-times-with-pwbevents
              '
              ' Other references "how-to" from the internet are shown in the code
              '
              ' Sizes of the Dialog window and Google map may be adjusted by changing the values in this code.
              ' Google Map does not size with the Dialog window. This should be programmed by yourself.
              '
              ' The grabbed Google Map can be stored by right clicking on the pop-up window.
              ' For high resolution images consult: https://developers.google.com/maps/documentation/static-maps/intro
              '
              ' The corner coordinates are obtained in the METHOD onclick
              ' and further processed in the SUB-routine Process_Googlemap in which also
              ' the image is captured
              '
              ' The display of the image window and handling should be tailored to your own application
              '[/COLOR]
              [COLOR=0000C0]#COMPILE EXE
              #DIM ALL[/COLOR]
              [COLOR=000000]%UNICODE [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]1
              %USEWEBBROWSER [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]1
              %USEOLECON [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]1                [/COLOR][COLOR=007F00]' // Use the OLE container[/COLOR]
              [COLOR=0000C0]#INCLUDE ONCE [/COLOR][COLOR=C020C0]"CWindow.inc"   [/COLOR][COLOR=007F00]' // CWindow class[/COLOR]
              [COLOR=0000C0]#INCLUDE ONCE [/COLOR][COLOR=C020C0]"MSHTML.INC"    [/COLOR][COLOR=007F00]' // MSHTML[/COLOR]
              
              [COLOR=000000]%IDC_WEBBROWSER           [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]1001    [/COLOR][COLOR=007F00]'Handle for the Webbrowser with the Google Map[/COLOR]
              [COLOR=000000]%IDC_CapImg               [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]1002    [/COLOR][COLOR=007F00]'Handle for the window with the Google map image[/COLOR]
              
              [COLOR=0000C0]FUNCTION PBMAIN  [/COLOR][COLOR=007F00]'---------- PBMAIN
              
                ' // Create an instance of the class
              [/COLOR][COLOR=0000C0]GLOBAL [/COLOR][COLOR=000000]pWindow [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IWindow
              
                pWindow [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]CLASS [/COLOR][COLOR=C020C0]"CWindow"
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pWindow[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT FUNCTION
              
              [/COLOR][COLOR=007F00]' // Initialize lat/lon as center point for the map
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]C_Lng[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]C_Lat [/COLOR][COLOR=0000C0]AS DOUBLE                    [/COLOR][COLOR=007F00]'Center coordinates for the initial Google Map
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]Zoom [/COLOR][COLOR=0000C0]AS LONG                             [/COLOR][COLOR=007F00]'Zoom for the initial Google Map
              
              
                'Start These statements have changed
              
                'port John Glenn International
                'LAT  39.99820898564898
                'LON -82.88432538514905
              
              [/COLOR][COLOR=000000]C_Lat[/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]39.99820898564898
                C_Lng[/COLOR][COLOR=8000FF]= -[/COLOR][COLOR=000000]82.88432538514905
              
                Zoom [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]20 [/COLOR][COLOR=007F00]'18                                       'Zoom is set to max Set amount of zoom of the Google Map
                'End These statements have changed
              
              
                ' // Set size of DIALOG, Browser and Google map
              [/COLOR][COLOR=0000C0]LOCAL   [/COLOR][COLOR=000000]xSzDlg  [/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]ySzDlg   [/COLOR][COLOR=0000C0]AS LONG             [/COLOR][COLOR=007F00]'Width and height of the Dialog window
              [/COLOR][COLOR=0000C0]GLOBAL  [/COLOR][COLOR=000000]xSzMap  [/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]ySzMap   [/COLOR][COLOR=0000C0]AS LONG             [/COLOR][COLOR=007F00]'x-size (width) and y-size (height)of the map in the browser window (is needed in the Javascript and in the SUB Process_GoogleMap)
              [/COLOR][COLOR=000000]xSzDlg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]300                 [/COLOR][COLOR=8000FF]: [/COLOR][COLOR=000000]ySzDlg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]300        [/COLOR][COLOR=007F00]'Set the x-size (width) and y-size (height) of the Dialog window
              [/COLOR][COLOR=000000]xSzMap  [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]xSzDlg[/COLOR][COLOR=8000FF]* [/COLOR][COLOR=000000]0.9                          [/COLOR][COLOR=007F00]'Calculate x-size (width)  of the map in the Browser window. Is used in the Javascript
              [/COLOR][COLOR=000000]ySzMap  [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]ySzDlg[/COLOR][COLOR=8000FF]*[/COLOR][COLOR=000000]0.78                          [/COLOR][COLOR=007F00]'Calculate y-size (height) of the map in the Browser window. Is used in the Javascript
              
                ' // Design of the Javascript code for retrieving the Google Map Corner Coordinates
              [/COLOR][COLOR=0000C0]DIM [/COLOR][COLOR=000000]s [/COLOR][COLOR=0000C0]AS WSTRING
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=C020C0]"<!DOCTYPE html>"           [/COLOR][COLOR=007F00]'The <!DOCTYPE> declaration represents the document type, and helps browsers to display web pages correctly.
                                                'It must only appear once, at the top of the page (before any HTML tags).
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<html>"[/COLOR][COLOR=007F00]'& $CRLF            'The <html> element is the root element of an HTML page
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<head>"[/COLOR][COLOR=007F00]'& $CRLF            'The <head> element contains meta information about the document
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"      <meta http-equiv='X-UA-Compatible' content='IE=edge'>"   [/COLOR][COLOR=007F00]'--> added: used Edge browser
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"      <meta http-equiv='MSThemeCompatible' content='Yes'>"     [/COLOR][COLOR=007F00]'--> added: allow visual styles
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF            [/COLOR][COLOR=007F00]'1st script
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"src='http://maps.googleapis.com/maps/api/js'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF    [/COLOR][COLOR=007F00]'invoke googleapi maps
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</head>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF           [/COLOR][COLOR=007F00]'2nd script
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"var map;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"function initialize() "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF    [/COLOR][COLOR=007F00]'Set map parameters
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"{"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=    [/COLOR][COLOR=C020C0]"var mapOpt = {"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=                   [/COLOR][COLOR=C020C0]" center:new google.maps.LatLng(" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]C_Lat[/COLOR][COLOR=8000FF]) & [/COLOR][COLOR=C020C0]"," [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]C_Lng[/COLOR][COLOR=8000FF]) & [/COLOR][COLOR=C020C0]"),"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=                   [/COLOR][COLOR=C020C0]" zoom:"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]LTRIM$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=0000C0]STR$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]Zoom[/COLOR][COLOR=8000FF])) & [/COLOR][COLOR=C020C0]","[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=                   [/COLOR][COLOR=C020C0]" mapTypeId:google.maps.MapTypeId.SATELLITE "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=                [/COLOR][COLOR=C020C0]" };"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=    [/COLOR][COLOR=C020C0]"map=new google.maps.Map(document.getElementById('googleMap'),mapOpt); "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF      [/COLOR][COLOR=007F00]'Make map with settings ('googleMap' is defined further on under the <body> tag)
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=    [/COLOR][COLOR=C020C0]"google.maps.event.addDomListener(map, 'center_changed' , function() "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF        [/COLOR][COLOR=007F00]'addDOMLIsterner must be placed here under the function "initialize" otherwise it won't work
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=    [/COLOR][COLOR=C020C0]"{" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=      [/COLOR][COLOR=C020C0]"var bounds = map.getBounds();"  [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF  [/COLOR][COLOR=007F00]' http://stackoverflow.com/questions/6910847/get-boundaries-longitude-and-latitude-from-current-zoom-google-maps
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=      [/COLOR][COLOR=C020C0]"var ne = bounds.getNorthEast();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF  [/COLOR][COLOR=007F00]' LatLng of the north-east corner    'northeast
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=      [/COLOR][COLOR=C020C0]"var sw = bounds.getSouthWest();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF  [/COLOR][COLOR=007F00]' LatLng of the south-west corder    'southwest
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=      [/COLOR][COLOR=C020C0]"document.getElementById('ne').value = ne;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF   [/COLOR][COLOR=007F00]'.value is needed here instead of .innerHTML see: http://www.w3schools.com/js/tryit.asp?filename=tryjs_function_return
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=      [/COLOR][COLOR=C020C0]"document.getElementById('sw').value = sw;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=    [/COLOR][COLOR=C020C0]"});"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"}"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script>" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF          [/COLOR][COLOR=007F00]'3rd script
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"function getCorners() "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF [/COLOR][COLOR=007F00]'Make a "Grab Coordinates"-button and only when clicking this button the coordinates are grabbed.
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"{" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var bounds = map.getBounds();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF       [/COLOR][COLOR=007F00]'http://stackoverflow.com/questions/6910847/get-boundaries-longitude-and-latitude-from-current-zoom-google-maps
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var ne_c = bounds.getNorthEast(); "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF  [/COLOR][COLOR=007F00]' Get LatLng of the north-east corner
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var sw_c = bounds.getSouthWest();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF   [/COLOR][COLOR=007F00]' Get LatLng of the south-west corder
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"document.getElementById('ne_coord').value = ne_c;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"document.getElementById('sw_coord').value = sw_c;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var zm = map.getZoom();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF             [/COLOR][COLOR=007F00]' Get the actual zoom
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"document.getElementById('zoom').value = zm;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"}" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF           [/COLOR][COLOR=007F00]'4th script                                     'https://www.w3.org/TR/DOM-Level-2-Events/events.html
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+= [/COLOR][COLOR=C020C0]"google.maps.event.addDomListener(window, 'load', initialize); "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF    [/COLOR][COLOR=007F00]'see https://developers.google.com/maps/documentation/javascript/events   Topic "Listening to DOM Events"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF                                                          [/COLOR][COLOR=007F00]'or   https://developers.google.com/maps/documentation/javascript/examples/event-domListener
                                                                                                'or tutorial http://www.w3schools.com/js/js_htmldom.asp  for more info on DOM
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<body>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<div id='googleMap' style='width:" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]LTRIM$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=0000C0]STR$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]xSzMap[/COLOR][COLOR=8000FF])) & [/COLOR][COLOR=C020C0]"px;height:" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]LTRIM$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=0000C0]STR$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]ySzMap[/COLOR][COLOR=8000FF])) & [/COLOR][COLOR=C020C0]"px;margin-left:0px;margin-top:0px'></div>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<br>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<input type='text' id='ne' name='ne' size='75' value='ne'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF   [/COLOR][COLOR=007F00]'https://www.experts-exchange.com/questions/28499086/Visual-Studio-2013-Get-latitude-Longitude-from-google-Map-in-windows-project.html#answer40294233
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<input type='text' id='sw' name='sw' size='75' value='sw'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<input type='button' id='Grab coordinates' name='button' value='Grab coordinates' onclick='getCorners()'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF    [/COLOR][COLOR=007F00]'MUST BE ONCLICK AS IN THE "CLASS CHTMLDocumentEvents2" THE METHOD is defined as ONCLICK !!!
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<br>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]" <input type='hidden'   id='ne_coord' name='ne_result' size='75' value='ne-coordinates'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]" <input type='hidden'   id='sw_coord' name='sw_result' size='75' value='sw-coordinates'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]" <input type='hidden'   id='zoom'     name='zm'        size='20' value='zoom'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</body> "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</html> "[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              
              [/COLOR][COLOR=007F00]' // Save the Javascript as a temporary file
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]bstrTempFileName   [/COLOR][COLOR=0000C0]AS WSTRING
              [/COLOR][COLOR=000000]bstrTempFileName [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]AfxSaveTempFile[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]s[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]""[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"TMP"[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"html"[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]1[/COLOR][COLOR=8000FF])
              
              [/COLOR][COLOR=007F00]' // Set the CLASS for capturing EVENTS in the Webbrowser
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]pWBEvents      [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]DWebBrowserEvents2Impl
                pWBEvents [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]CLASS [/COLOR][COLOR=C020C0]"CDWebBrowserEvents2"
              
              [/COLOR][COLOR=007F00]' // Create the Dialog/WebBrowser control with the embedded map
              [/COLOR][COLOR=0000C0]GLOBAL [/COLOR][COLOR=000000]hDlg  [/COLOR][COLOR=0000C0]AS DWORD               [/COLOR][COLOR=007F00]'Reference to Dialog window (which is the webbrowser window)
              [/COLOR][COLOR=0000C0]DIALOG NEW PIXELS[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]0[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"PB with Webbrowser"[/COLOR][COLOR=8000FF], , , [/COLOR][COLOR=000000]xSzDlg[/COLOR][COLOR=8000FF],[/COLOR][COLOR=000000]ySzDlg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]%WS_OVERLAPPEDWINDOW TO [/COLOR][COLOR=000000]hDlg               [/COLOR][COLOR=007F00]'Make Dialog window
              [/COLOR][COLOR=000000]pWindow.AddWebBrowserControl[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]hDlg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]%IDC_WEBBROWSER[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]bstrTempFileName[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]pWBEvents[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]0[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]0[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]xSzDlg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]ySzDlg[/COLOR][COLOR=8000FF])    [/COLOR][COLOR=007F00]'AddWebBrowserControl is a METHOD defined in CWindow.INC
                                                                                                                          'pWBEvents is a call to the Events
                '// Show Dialog and start the Callback Processor
              [/COLOR][COLOR=0000C0]DIALOG SHOW MODAL [/COLOR][COLOR=000000]hDlg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]CALL [/COLOR][COLOR=000000]DlgProc[/COLOR]
              
              [COLOR=0000C0]END FUNCTION [/COLOR][COLOR=007F00]'---------- END PBMAIN
              
              
              ' ========================================================================================
              ' Main Dialog CALLBACK procedure
              ' ========================================================================================[/COLOR]
              [COLOR=0000C0]CALLBACK FUNCTION [/COLOR][COLOR=000000]DlgProc[/COLOR][COLOR=8000FF]() [/COLOR][COLOR=0000C0]AS LONG
              
              SELECT CASE CB.MSG
              CASE %WM_INITDIALOG
                   DIALOG ENABLE [/COLOR][COLOR=000000]hDlg[/COLOR]
              
              [COLOR=007F00]'CASE %WM_COMMAND
              ' SELECT CASE AS LONG CB.CTL
              '   CASE %IDC_BUTTON
              '     IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
              '      MSGBOX "CLICK"
              '     END IF
              
              ' ...
              'END SELECT[/COLOR]
              [COLOR=0000C0]CASE %WM_SIZE
              IF CB.WPARAM [/COLOR][COLOR=8000FF]<> [/COLOR][COLOR=000000]%SIZE_MINIMIZED [/COLOR][COLOR=0000C0]THEN[/COLOR]
              [COLOR=007F00]'
              ' When RESIZING the browser window. The Google Map size stays the same.
              ' If the Google Map need to be resized as well then teh Javascript must be run again.
              '[/COLOR]
              
              [COLOR=0000C0]END IF
              CASE %WM_DESTROY[/COLOR]
              [COLOR=000000]hdlg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]0[/COLOR]
              [COLOR=0000C0]END SELECT
              
              END FUNCTION[/COLOR]
              [COLOR=007F00]' ========================================================================================
              
              
              
              ' ########################################################################################
              ' Class CDWebBrowserEvents2
              ' Interface name = DWebBrowserEvents2
              ' IID = {34A715A0-6587-11D0-924A-0020AFC7AC4D}
              ' Web Browser Control events interface
              ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
              ' ########################################################################################[/COLOR]
              
              [COLOR=0000C0]CLASS [/COLOR][COLOR=000000]CDWebBrowserEvents2 [/COLOR][COLOR=0000C0]GUID$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=C020C0]"{700B73A2-CCFC-4FE0-B9AC-D5853D71B7B9}"[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]AS EVENT
              
                 INSTANCE [/COLOR][COLOR=000000]pIWebBrowser2 [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IWebBrowser2
              [/COLOR][COLOR=0000C0]INSTANCE [/COLOR][COLOR=000000]pHTMLDocumentEvents2 [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]HTMLDocumentEvents2Impl
              
              [/COLOR][COLOR=007F00]' =====================================================================================
              [/COLOR][COLOR=0000C0]CLASS METHOD DESTROY
              [/COLOR][COLOR=007F00]' Disconnect events
              [/COLOR][COLOR=0000C0]IF ISOBJECT[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocumentEvents2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EVENTS END [/COLOR][COLOR=000000]pHTMLDocumentEvents2
              [/COLOR][COLOR=0000C0]END METHOD
              [/COLOR][COLOR=007F00]' =====================================================================================
              
              ' ========================================================================================
              ' Implementation of the interface
              ' ========================================================================================[/COLOR]
              [COLOR=0000C0]INTERFACE [/COLOR][COLOR=000000]DWebBrowserEvents2Impl [/COLOR][COLOR=0000C0]GUID$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=C020C0]"{34A715A0-6587-11D0-924A-0020AFC7AC4D}"[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]AS EVENT
              
                INHERIT IDISPATCH
              
              [/COLOR][COLOR=007F00]' =====================================================================================
                 ' Note (October 2, 2016):
                 ' The METHOD DocumentComplete has been placed here as the original METHOD DownloadComplete
                 ' fires three times. See:
                 ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/753161-addwebbrowsercontrol-fires-three-times-with-pwbevents
                 ' However the DocumentComplete does not fire when the Webbrowser is not visible.
                 ' See: BUG: DocumentComplete Does Not Fire When WebBrowser Is Not Visible
                 ' http://support.microsoft.com/kb/q259935/
                 ' =====================================================================================
              [/COLOR][COLOR=0000C0]METHOD [/COLOR][COLOR=000000]DocumentComplete [/COLOR][COLOR=8000FF]<[/COLOR][COLOR=000000]259[/COLOR][COLOR=8000FF]> ( [/COLOR][COLOR=0000C0]_
                   BYVAL [/COLOR][COLOR=000000]pDisp [/COLOR][COLOR=0000C0]AS IDISPATCH _                         [/COLOR][COLOR=007F00]' __in IDispatch* pDisp
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vURL [/COLOR][COLOR=0000C0]AS VARIANT _                            [/COLOR][COLOR=007F00]' __in VARIANT* URL
              [/COLOR][COLOR=8000FF])                                                    [/COLOR][COLOR=007F00]' void
              
                    ' Get a reference to the IHTMLDocument2 interface
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]pHTMLDocument2 [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IHTMLDocument2
                    pHTMLDocument2 [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]pIWebBrowser2.Document
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocument2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT METHOD
              [/COLOR][COLOR=007F00]' Connect to the events fired by the page
              [/COLOR][COLOR=000000]pHTMLDocumentEvents2 [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]CLASS [/COLOR][COLOR=C020C0]"CHTMLDocumentEvents2"
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocumentEvents2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT METHOD
                    EVENTS FROM [/COLOR][COLOR=000000]pHTMLDocument2 [/COLOR][COLOR=0000C0]CALL [/COLOR][COLOR=000000]pHTMLDocumentEvents2
              
              [/COLOR][COLOR=0000C0]END METHOD
              [/COLOR][COLOR=007F00]' =====================================================================================
              
                 ' =====================================================================================
              [/COLOR][COLOR=0000C0]METHOD [/COLOR][COLOR=000000]BeforeNavigate2 [/COLOR][COLOR=8000FF]<[/COLOR][COLOR=000000]250[/COLOR][COLOR=8000FF]> ( [/COLOR][COLOR=0000C0]_
                   BYVAL [/COLOR][COLOR=000000]pDisp [/COLOR][COLOR=0000C0]AS IDISPATCH _                         [/COLOR][COLOR=007F00]' __in IDispatch* pDisp
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vURL [/COLOR][COLOR=0000C0]AS VARIANT _                            [/COLOR][COLOR=007F00]' __in VARIANT* URL
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vFlags [/COLOR][COLOR=0000C0]AS VARIANT _                          [/COLOR][COLOR=007F00]' __in VARIANT* Flags
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vTargetFrameName [/COLOR][COLOR=0000C0]AS VARIANT _                [/COLOR][COLOR=007F00]' __in VARIANT* TargetFrameName
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vPostData [/COLOR][COLOR=0000C0]AS VARIANT _                       [/COLOR][COLOR=007F00]' __in VARIANT* PostData
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]vHeaders [/COLOR][COLOR=0000C0]AS VARIANT _                        [/COLOR][COLOR=007F00]' __in VARIANT* Headers
              [/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYREF [/COLOR][COLOR=000000]bCancel [/COLOR][COLOR=0000C0]AS INTEGER _                         [/COLOR][COLOR=007F00]' __in_out VARIANT_BOOL* Cancel
              [/COLOR][COLOR=8000FF])                                                    [/COLOR][COLOR=007F00]' void
              
                    ' Get a reference to the WebBrowser control
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pIWebBrowser2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN [/COLOR][COLOR=000000]pIWebBrowser2 [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]pDisp
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pIWebBrowser2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT METHOD
              [/COLOR][COLOR=007F00]' If there was a previous loaded page, disconnect from the events
              [/COLOR][COLOR=0000C0]IF ISOBJECT[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocumentEvents2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN
                       EVENTS END [/COLOR][COLOR=000000]pHTMLDocumentEvents2
                       pHTMLDocumentEvents2 [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]NOTHING
                    END IF
              
                 END METHOD
              [/COLOR][COLOR=007F00]' =====================================================================================[/COLOR]
              
              [COLOR=0000C0]END INTERFACE
              
              END CLASS[/COLOR]
              [COLOR=007F00]' ########################################################################################
              
              
              ' ########################################################################################
              ' Class CHTMLDocumentEvents2
              ' Interface name = HTMLDocumentEvents2
              ' IID = {3050F613-98B5-11CF-BB82-00AA00BDCE0B}
              ' Attributes = 4112 [&H1010] [Hidden] [Dispatchable]
              ' ########################################################################################[/COLOR]
              
              [COLOR=0000C0]CLASS [/COLOR][COLOR=000000]CHTMLDocumentEvents2 [/COLOR][COLOR=0000C0]GUID$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=C020C0]"{1FFB0071-8BCC-4BBD-BC29-A662FAE87C82}"[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]AS EVENT
              
              INTERFACE [/COLOR][COLOR=000000]HTMLDocumentEvents2Impl [/COLOR][COLOR=0000C0]GUID$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=C020C0]"{3050F613-98B5-11CF-BB82-00AA00BDCE0B}"[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]AS EVENT
              
                INHERIT IDISPATCH
              
              [/COLOR][COLOR=007F00]' =====================================================================================
              [/COLOR][COLOR=0000C0]METHOD [/COLOR][COLOR=000000]onclick [/COLOR][COLOR=8000FF]<-[/COLOR][COLOR=000000]600[/COLOR][COLOR=8000FF]> ( [/COLOR][COLOR=0000C0]_
                   BYVAL [/COLOR][COLOR=000000]pEvtObj [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IHTMLEventObj [/COLOR][COLOR=0000C0]_                   [/COLOR][COLOR=007F00]' __in IHTMLEventObj* pEvtObj
              [/COLOR][COLOR=8000FF])                                                    [/COLOR][COLOR=007F00]' void
              
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]pElement [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IHTMLElement           [/COLOR][COLOR=007F00]' // Element that has fired the event
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]pHTMLDocument2 [/COLOR][COLOR=0000C0]AS [/COLOR][COLOR=000000]IHTMLDocument2   [/COLOR][COLOR=007F00]' // Document object
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]bstrId [/COLOR][COLOR=0000C0]AS WSTRING                  [/COLOR][COLOR=007F00]' // Identifier of the element that has fired the event
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]bstrValue [/COLOR][COLOR=0000C0]AS WSTRING               [/COLOR][COLOR=007F00]' // Value of the property
              
                    ' // Get a reference to the element that has fired the event
              [/COLOR][COLOR=0000C0]IF ISOBJECT[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pEvtObj[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN [/COLOR][COLOR=000000]pElement [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]pEvtObj.srcElement
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pElement[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT METHOD
              
              [/COLOR][COLOR=007F00]' // Get a reference to the IHTMLDocument2 interface
              [/COLOR][COLOR=000000]pHTMLDocument2 [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]pElement.document
              [/COLOR][COLOR=0000C0]IF ISNOTHING[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocument2[/COLOR][COLOR=8000FF]) [/COLOR][COLOR=0000C0]THEN EXIT METHOD
              
              [/COLOR][COLOR=007F00]' // Get the identifier of the element that has fired the event
              [/COLOR][COLOR=000000]bstrId [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]pElement.id
              [/COLOR][COLOR=007F00]'MSGBOX bstrId
              
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]NE_Coord_STR [/COLOR][COLOR=0000C0]AS STRING                  [/COLOR][COLOR=007F00]'Grabbed NE Coordinates as string
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]SW_Coord_STR [/COLOR][COLOR=0000C0]AS STRING                  [/COLOR][COLOR=007F00]'Grabbed SW Coordinates as string
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]Zoom_STR [/COLOR][COLOR=0000C0]AS STRING                      [/COLOR][COLOR=007F00]'Grabbed Zoom as string
              
              [/COLOR][COLOR=0000C0]SELECT CASE [/COLOR][COLOR=000000]bstrId
              [/COLOR][COLOR=007F00]'MSGBOX bstrId
              [/COLOR][COLOR=0000C0]CASE [/COLOR][COLOR=C020C0]"Grab coordinates"
              [/COLOR][COLOR=000000]bstrValue [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]IHTMLDocument_getElementValueById[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocument2[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"ne_coord"[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=000000]NE_Coord_STR[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]bstrValue
                           bstrValue [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]IHTMLDocument_getElementValueById[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocument2[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"sw_coord"[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=000000]SW_Coord_STR[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]bstrValue
                           bstrValue [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]IHTMLDocument_getElementValueById[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]pHTMLDocument2[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"zm"[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=000000]Zoom_STR[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]bstrValue
              [/COLOR][COLOR=0000C0]CALL [/COLOR][COLOR=000000]Process_GoogleMap[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_Coord_STR[/COLOR][COLOR=8000FF],[/COLOR][COLOR=000000]SW_Coord_STR[/COLOR][COLOR=8000FF],[/COLOR][COLOR=000000]Zoom_STR[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=0000C0]END SELECT
              
                 END METHOD
              [/COLOR][COLOR=007F00]' =====================================================================================[/COLOR]
              
              [COLOR=0000C0]END INTERFACE
              
              END CLASS[/COLOR]
              [COLOR=007F00]' ########################################################################################
              
              
              
              '---------------- SUB Process_GoogleMap
              '
              ' Retrieves lat/lng from string coordinates
              ' Grabs the GoogleMap image
              '[/COLOR]
              [COLOR=0000C0]SUB [/COLOR][COLOR=000000]Process_GoogleMap[/COLOR][COLOR=8000FF]([/COLOR][COLOR=0000C0]BYVAL [/COLOR][COLOR=000000]NE_Coord_STR [/COLOR][COLOR=0000C0]AS STRING[/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYVAL [/COLOR][COLOR=000000]SW_Coord_STR [/COLOR][COLOR=0000C0]AS STRING[/COLOR][COLOR=8000FF], [/COLOR][COLOR=0000C0]BYVAL [/COLOR][COLOR=000000]Zoom_STR [/COLOR][COLOR=0000C0]AS STRING[/COLOR][COLOR=8000FF])
              
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]CommaPos [/COLOR][COLOR=0000C0]AS LONG
                LOCAL [/COLOR][COLOR=000000]NE_LatStr[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]NE_LngStr[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]SW_LatStr[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]SW_LngStr [/COLOR][COLOR=0000C0]AS STRING
                LOCAL [/COLOR][COLOR=000000]NE_Lat[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]NE_lng[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]SW_Lat[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]SW_Lng [/COLOR][COLOR=0000C0]AS DOUBLE
              
              
              [/COLOR][COLOR=007F00]'Start These statements have changed
              [/COLOR][COLOR=000000]NE_LatStr [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]PARSE$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_Coord_STR[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]","[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]1[/COLOR][COLOR=8000FF])   [/COLOR][COLOR=007F00]'Take the left portion up to the comma
              [/COLOR][COLOR=0000C0]REPLACE [/COLOR][COLOR=C020C0]"(" [/COLOR][COLOR=0000C0]WITH [/COLOR][COLOR=C020C0]"" [/COLOR][COLOR=0000C0]IN [/COLOR][COLOR=000000]NE_LatStr
                NE_LngStr [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]PARSE$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_Coord_STR[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]","[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]2[/COLOR][COLOR=8000FF])   [/COLOR][COLOR=007F00]'Take the right portion from the comma to the end
              [/COLOR][COLOR=0000C0]REPLACE [/COLOR][COLOR=C020C0]")" [/COLOR][COLOR=0000C0]WITH [/COLOR][COLOR=C020C0]"" [/COLOR][COLOR=0000C0]IN [/COLOR][COLOR=000000]NE_LngStr
              
                NE_Lat    [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]VAL[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_LatStr[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=000000]NE_Lng    [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]VAL[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_LngStr[/COLOR][COLOR=8000FF])
              
              [/COLOR][COLOR=000000]SW_LatStr [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]PARSE$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_Coord_STR[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]","[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]1[/COLOR][COLOR=8000FF])   [/COLOR][COLOR=007F00]'Take the left portion up to the comma
              [/COLOR][COLOR=0000C0]REPLACE [/COLOR][COLOR=C020C0]"(" [/COLOR][COLOR=0000C0]WITH [/COLOR][COLOR=C020C0]"" [/COLOR][COLOR=0000C0]IN [/COLOR][COLOR=000000]SW_LatStr
                SW_LngStr [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]PARSE$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_Coord_STR[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]","[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]2[/COLOR][COLOR=8000FF])   [/COLOR][COLOR=007F00]'Take the right portion from the comma to the end
              [/COLOR][COLOR=0000C0]REPLACE [/COLOR][COLOR=C020C0]")" [/COLOR][COLOR=0000C0]WITH [/COLOR][COLOR=C020C0]"" [/COLOR][COLOR=0000C0]IN [/COLOR][COLOR=000000]SW_LngStr
              
                SW_Lat    [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]VAL[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_LatStr[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=000000]SW_Lng    [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=0000C0]VAL[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_LngStr[/COLOR][COLOR=8000FF])
              [/COLOR][COLOR=007F00]'End These statements have changed
              
              
                ' // Google Map position stays the same when the Dialog is enlarged (in this version of the program).
                ' // Calculate center of the map  (Center coordinates needed to grab the image)
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]C_Lat[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]C_Lng [/COLOR][COLOR=0000C0]AS DOUBLE
              
              [/COLOR][COLOR=000000]C_Lat[/COLOR][COLOR=8000FF]=([/COLOR][COLOR=000000]SW_Lat[/COLOR][COLOR=8000FF]+[/COLOR][COLOR=000000]NE_Lat[/COLOR][COLOR=8000FF])/[/COLOR][COLOR=000000]2
                C_Lng[/COLOR][COLOR=8000FF]=([/COLOR][COLOR=000000]SW_Lng[/COLOR][COLOR=8000FF]+[/COLOR][COLOR=000000]NE_Lng[/COLOR][COLOR=8000FF])/[/COLOR][COLOR=000000]2   [/COLOR][COLOR=007F00]'For Lng around +180/-180 another calculation is needed (not implemented yet)
              
                ' // Define and set size of captured image window
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]xPosCapImg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]yPosCapImg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]xSzCapImg[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]ySzCapImg [/COLOR][COLOR=0000C0]AS LONG
              
              [/COLOR][COLOR=000000]xPosCapImg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]0            [/COLOR][COLOR=007F00]'x position of the captured image
              [/COLOR][COLOR=000000]yPosCapImg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]0            [/COLOR][COLOR=007F00]'y position of the captured image
              [/COLOR][COLOR=000000]xSzCapImg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]1.1[/COLOR][COLOR=8000FF]*[/COLOR][COLOR=000000]xSzMap    [/COLOR][COLOR=007F00]'x-size (width)  of the captured image window. Factor 1.1 just taken to show the image inside the popup window
              [/COLOR][COLOR=000000]ySzCapImg[/COLOR][COLOR=8000FF]=[/COLOR][COLOR=000000]1.1[/COLOR][COLOR=8000FF]*[/COLOR][COLOR=000000]ySzMap    [/COLOR][COLOR=007F00]'y-size (height) of the captured image window
              
                'Make a Javascript for catching a static Google Map
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]s [/COLOR][COLOR=0000C0]AS WSTRING
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<!DOCTYPE html>"   [/COLOR][COLOR=007F00]'Script from   https://seydahatipoglu.wordpress.com/2012/10/26/export-google-map-to-image/
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<html>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<head runat='server'>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</head>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<body>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF                [/COLOR][COLOR=007F00]'1st script
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"function refreshMapUrl()"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"{"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var mapImage = document.getElementById('imgMap');"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"var mapUrl = 'http://maps.googleapis.com/maps/api/staticmap?"   [/COLOR][COLOR=007F00]'See for options: https://developers.google.com/maps/documentation/static-maps/intro
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"center=" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]C_Lat[/COLOR][COLOR=8000FF]) & [/COLOR][COLOR=C020C0]"," [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]C_Lng[/COLOR][COLOR=8000FF])  &[/COLOR][COLOR=C020C0]"&"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"zoom=" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=000000]Zoom_STR [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=C020C0]"&"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"size=" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]xSzMap[/COLOR][COLOR=8000FF]) & [/COLOR][COLOR=C020C0]"x" [/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]ySzMap[/COLOR][COLOR=8000FF])&[/COLOR][COLOR=C020C0]"&"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"&maptype=satellite&"
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"sensor=false';"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=  [/COLOR][COLOR=C020C0]"mapImage.src=mapUrl;"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"}"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<img alt='' src='' id='imgMap'  />"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"<script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF              [/COLOR][COLOR=007F00]'2nd script calls the defined function in the 1st script
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"refreshMapUrl();"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</script>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</body>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              [/COLOR][COLOR=000000]s [/COLOR][COLOR=8000FF]+=[/COLOR][COLOR=C020C0]"</html>"[/COLOR][COLOR=8000FF]& [/COLOR][COLOR=0000C0]$CRLF
              
              [/COLOR][COLOR=007F00]' // Save the Javascript for grabbing the image as a temporary file
              [/COLOR][COLOR=0000C0]LOCAL [/COLOR][COLOR=000000]bstrTempFileName   [/COLOR][COLOR=0000C0]AS WSTRING
              [/COLOR][COLOR=000000]bstrTempFileName [/COLOR][COLOR=8000FF]= [/COLOR][COLOR=000000]AfxSaveTempFile[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]s[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]""[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"TMP"[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"html"[/COLOR][COLOR=8000FF], [/COLOR][COLOR=000000]1[/COLOR][COLOR=8000FF])
              
              [/COLOR][COLOR=007F00]'//Create popup window with the grabbed Google Map image
              [/COLOR][COLOR=0000C0]DIM [/COLOR][COLOR=000000]hImg [/COLOR][COLOR=0000C0]AS GLOBAL DWORD          [/COLOR][COLOR=007F00]'Handle for the image window (is used in the CALLBACK and SUB Process_Googlemap
              
                'Start These statements have changed (commented out)
                'DIALOG NEW PIXELS, hImg, "Grabbed Google Map image",-10 ,10 , xSzCapImg, ySzCapImg, %WS_CAPTION OR %WS_SYSMENU TO hImg       'Make Captured Image window
                'pWindow.AddWebBrowserControl(hImg, %IDC_CapImg , bstrTempFileName, NOTHING, 0, 0, xSzCapImg, ySzCapImg)    'AddWebBrowserControl is a METHOD defined in CWindow.INC
                '
                'DIALOG SHOW MODAL hImg, CALL DlgProc           'Show Dialog and start the Callback Processor
                'End These statements have changed
              
                'added this to provide center of image location information
                'Press Grab Coordinates to see this info
              [/COLOR][COLOR=0000C0]? [/COLOR][COLOR=C020C0]"Location Center Latitude & Longitude:" [/COLOR][COLOR=8000FF]+ [/COLOR][COLOR=0000C0]$CRLF [/COLOR][COLOR=8000FF]+ [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF]([/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF](([/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_Lat[/COLOR][COLOR=8000FF]) - [/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_Lat[/COLOR][COLOR=8000FF]))/[/COLOR][COLOR=000000]2[/COLOR][COLOR=8000FF]) + [/COLOR][COLOR=000000]SW_Lat[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"###.##############"[/COLOR][COLOR=8000FF]) + [/COLOR][COLOR=C020C0]", " [/COLOR][COLOR=8000FF]+ [/COLOR][COLOR=0000C0]_[/COLOR][COLOR=007F00]'= Y_center
              [/COLOR][COLOR=0000C0]FORMAT$[/COLOR][COLOR=8000FF](-[/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF](([/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]NE_Lng[/COLOR][COLOR=8000FF]) - [/COLOR][COLOR=0000C0]ABS[/COLOR][COLOR=8000FF]([/COLOR][COLOR=000000]SW_Lng[/COLOR][COLOR=8000FF]))/[/COLOR][COLOR=000000]2[/COLOR][COLOR=8000FF]) + [/COLOR][COLOR=000000]NE_Lng[/COLOR][COLOR=8000FF], [/COLOR][COLOR=C020C0]"###.##############"[/COLOR][COLOR=8000FF])[/COLOR]
              
              
              [COLOR=0000C0]END SUB  [/COLOR][COLOR=007F00]'---------------- END Process_GoogleMap
              
              
              
              ' ========================================================================================
              ' Image CALLBACK procedure (not used)
              ' ========================================================================================[/COLOR]
              [COLOR=0000C0]CALLBACK FUNCTION [/COLOR][COLOR=000000]ImgProc[/COLOR][COLOR=8000FF]() [/COLOR][COLOR=0000C0]AS LONG
              
              SELECT CASE CB.MSG
              CASE %WM_INITDIALOG
              
              
              CASE %WM_COMMAND
               SELECT CASE AS LONG CB.CTL[/COLOR]
              [COLOR=007F00]'   CASE %IDC_BUTTON
              '     IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
              '      MSGBOX "CLICK"
              '     END IF
              
              
              ' ...[/COLOR]
              [COLOR=0000C0]END SELECT[/COLOR]
              [COLOR=007F00]'CASE %WM_SIZE
              'IF CB.WPARAM <> %SIZE_MINIMIZED THEN
              '  LOCAL xSzDlgNew, ySzDlgNew AS LONG
              '  DIALOG GET CLIENT CB.HNDL TO xSzDlgNew, ySzDlgNew
               ' CONTROL SET SIZE CB.HNDL, %IDC_WEBBROWSER, xSzBrowNew, ySzBrowNew
              'END IF[/COLOR]
              [COLOR=0000C0]CASE %WM_DESTROY[/COLOR]
              [COLOR=000000]PostQuitMessage 0[/COLOR]
              [COLOR=0000C0]END SELECT
              
              END FUNCTION[/COLOR]
              [COLOR=007F00]' ========================================================================================[/COLOR]

              Comment

              Working...
              X
              😀
              🥰
              🤢
              😎
              😡
              👍
              👎