View Single Post

  #3 (permalink)  
Old 06-09-2007
Eric Frost's Avatar
Eric Frost Eric Frost is offline
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,322
Blog Entries: 1
Re: Extending the MapPoint ActiveX Control - Pt. II

I was taking a look at the code for this and wondering if there is a way to trigger or simulate clicking the Freeform button on the drawing toolbar?




Code:
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' (R) 2003 Sergiy Pavlov -- Do not remove this header
'     baal_2000  AT  yahoo   DOT   com
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'  This source code is provided "as is" and  can only  be used in accordance
'  with the terms and conditions of the Microsoft MapPoint 2002 and Microsoft
'  Visual Basic End User License Agreements.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Private objMap As clsMapPoint
Private Sub mnuAddAsEnd_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdAddAsEnd)
End Sub
Private Sub mnuAddAsStart_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdAddAsStart)
End Sub
Private Sub mnuAddAsStop_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdAddAsStop)
End Sub
Private Sub mnuAlwaysShowPosition_Click()
    Call objMap.SendCommand(MapPointMenu.mnuTools.cmdGPSAlwaysShowPosition)
End Sub
Private Sub mnuAvoidArea_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdAvoidArea)
End Sub
Private Sub mnuClearRoute_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdClearRoute)
End Sub
Private Sub mnuConstructionInfoUpdate_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdRoadConstructionNfoUpd)
End Sub
Private Sub mnuCopy_Click()
        Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdCopy)
End Sub
Private Sub mnuCopyDirections_Click()
        Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdCopyDirections)
End Sub
Private Sub mnuCopyMap_Click()
        Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdCopyMap)
End Sub
Private Sub mnuCopyShortcut_Click()
    Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdCopyShortcut)
End Sub
Private Sub mnuDataMappingWizard_Click()
        Call objMap.SendCommand(MapPointMenu.mnuData.cmdDataMappingWizard)
End Sub
Private Sub mnuDirections_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdDirections)
End Sub
Private Sub mnuDrawing_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdTBDrawing)
End Sub
Private Sub mnuExit_Click()
    Unload Me
End Sub
Private Sub mnuExportToExcel_Click()
        Call objMap.SendCommand(MapPointMenu.mnuData.cmdExportToExcel)
End Sub
Private Sub mnuFind_Click()
    Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdFind)
End Sub
Private Sub mnuFindNearbyPlaces_Click()
    Call objMap.SendCommand(MapPointMenu.mnuTools.cmdFindNearbyPlaces)
End Sub
Private Sub mnuFontLarge_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdFont_Large)
End Sub
Private Sub mnuFontLargest_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdFont_Largest)
End Sub
Private Sub mnuFontMedium_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdFont_Medium)
End Sub
Private Sub mnuFontSmall_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdFont_Small)
End Sub
Private Sub mnuFontSmallest_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdFont_Smallest)
End Sub
Private Sub mnuGetDirections_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdGetDirections)
End Sub
Private Sub mnuGPSReceiverSettings_Click()
        Call objMap.SendCommand(MapPointMenu.mnuTools.cmdGPSReceiverSettings)
End Sub
Private Sub mnuGPSSensor_Click()
        Call objMap.SendCommand(MapPointMenu.mnuTools.cmdGPSSensor)
End Sub
Private Sub mnuGPSTrackPosition_Click()
        Call objMap.SendCommand(MapPointMenu.mnuTools.cmdGPSTrackPosition)
End Sub
Private Sub mnuImportDataWizard_Click()
        Call objMap.SendCommand(MapPointMenu.mnuData.cmdImportDataWizard)
End Sub
Private Sub mnuLegendAndOverview_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdLegendAndOverview)
End Sub
Private Sub mnuLinkDataWizard_Click()
        Call objMap.SendCommand(MapPointMenu.mnuData.cmdLinkDataWizard)
End Sub
Private Sub mnuLocationAndScale_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdTBLocationAndScale)
End Sub
Private Sub mnuLocationSensor_Click()
    objMap.LocationSensorVisible = Not objMap.LocationSensorVisible
End Sub
Private Sub mnuMapPointHelp_Click()
    Call objMap.SendCommand(MapPointMenu.mnuHelp.cmdMapPointHelp)
End Sub
Private Sub mnuMapPolitical_Click()
    Call objMap.SendCommand(MapPointMenu.mnuView.cmdMapStyle_Political)
End Sub
Private Sub mnuMapStyleRoads_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdMapStyle_Roads)
End Sub
Private Sub mnuMapStyleRoadsAndData_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdMapStyle_RoadsAndData)
End Sub
Private Sub mnuMapStyleTerrain_Click()
    Call objMap.SendCommand(MapPointMenu.mnuView.cmdMapStyle_Terrain)
End Sub
Private Sub mnuMeasureDist_Click()
        Call objMap.SendCommand(MapPointMenu.mnuTools.cmdMeasureDistance)
End Sub
Private Sub mnuNavigateBack_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdBack)
End Sub
Private Sub mnuNavigateForward_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdForward)
End Sub
Private Sub mnuNavigation_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdTBNavigation)
End Sub
Private Sub mnuOptimizeStops_Click()
    Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdOptimizeStops)
End Sub
Private Sub mnuOptions_Click()
    Call objMap.SendCommand(MapPointMenu.mnuTools.cmdOptions)
End Sub
Private Sub mnuPageSetup_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdPageSetup)
End Sub
Private Sub mnuPaste_Click()
    Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdPaste)
End Sub
Private Sub mnuPrint_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdPrint)
End Sub
Private Sub mnuRedo_Click()
        Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdRedo)
End Sub
Private Sub mnuRouteOptions_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdRouteOptions)
End Sub
Private Sub mnuExport_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdExportToPocketStreets)
End Sub
Private Sub mnuRoutePlanner_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdRoutePlanner)
End Sub
Private Sub mnuSaveAs_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdSaveAs)
End Sub
Private Sub mnuSaveAsWebPage_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdSaveAsWebPage)
End Sub
Private Sub mnuManageSavedWebPages_Click()
        Call objMap.SendCommand(MapPointMenu.mnuFile.cmdManageSavedWebPages)
End Sub
Private Sub mnuScheduleStop_Click()
        Call objMap.SendCommand(MapPointMenu.mnuRoute.cmdScheduleStop)
End Sub
Private Sub mnuSendMapFeedback_Click()
        Call objMap.SendCommand(MapPointMenu.mnuTools.cmdSendMapFeedback)
End Sub
Private Sub mnuShowOrHidePlaces_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdShowOrHidePlaces)
End Sub
Private Sub mnuStandard_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdTBStandard)
End Sub
Private Sub mnuTerritories_Click()
        Call objMap.SendCommand(MapPointMenu.mnuData.cmdTerritories)
End Sub
Private Sub mnuTestSaveAsWebPage_Click()
    Dim TWnd As New TWindow
 
    TWnd.hWnd = objMap.hWnd_EXE 'got the target!
 
    'toggle SaveAsWebPage dialog!
    Call TWnd.PostMessageLong(WM_COMMAND, 35032)
End Sub
Private Sub mnuUndo_Click()
        Call objMap.SendCommand(MapPointMenu.mnuEdit.cmdUndo)
End Sub
Private Sub mnuZoomIn_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_In)
End Sub
Private Sub mnuZoomOut_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_Out)
End Sub
Private Sub mnuZoomTo48States_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_To48States)
End Sub
Private Sub mnuZoomToData_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_ToData)
End Sub
Private Sub mnuZoomToEntireRoute_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_ToEntireRoute)
End Sub
Private Sub mnuZoomToNorthAmerica_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_ToNorthAm)
End Sub
Private Sub mnuZoomToSelection_Click()
        Call objMap.SendCommand(MapPointMenu.mnuView.cmdZoom_ToSelection)
End Sub
Private Sub RoadsAndDatamnuMapStyleData_Click()
    Call objMap.SendCommand(MapPointMenu.mnuView.cmdMapStyle_Data)
End Sub
Private Sub CheckLocationSensorTimer1_Timer()
    'Check for LocationSensor here
    On Error Resume Next
    Dim bIsChecked As BorderStyleConstants
    bIsChecked = objMap.LocationSensorVisible
    If mnuLocationSensor.Checked <> bIsChecked Then
        mnuLocationSensor.Checked = bIsChecked
    End If
End Sub
Private Sub Form_Load()
        Set objMap = New clsMapPoint
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Set objMap = Nothing
End Sub
Reply With Quote