How To: Convert a MapObjects 1.2 application to use MapObjects 2.x
Instructions provided are the steps to upgrade MapObjects 1.2 applications written with Visual Basic to MapObjects 2.x.
Some of these steps are not necessary in all cases.
- Remove the Map controls from all forms in the project.
- Remove 'ESRI MapObjects' (mo10.ocx) from the list of Project Component references.
- Add 'ESRI MapObjects 2.0' (mo20.ocx) to the list of project component references. If this fails, or if placing the Map control on the form results in an error, follow these steps:
A) Save the project and close VB.
B) Re-register the mo20.ocx, re-open VB, re-load the project.
C) Add mo20.ocx as a component to the project.
- Add the Map control to the forms from which you removed them in Step 1 above.
- Run a global search and replace 'MapObjects.' with 'MapObjects2.'
- Run a global search and replace 'MoPlus.' with 'MapObjects2.'
- If 'MoPlus.dll' is a reference in your project, remove it from the Project References.
- Run a global search for 'AddressMatcher'. If any are found, this indicates the project includes geocoding. All geocoding functionality in the project will need to be redeveloped using the new objects. This is not an easy search-and-replace operation. It will require additional development. For help in doing this, refer to: a) the booklet that came with the software called: "Building Applications with MapObjects", Chapter 8; b) the MapObjects 2.0 online Help; and c) the sample code written into the Geocoder and MoView2 sample projects.
- Run a global search for '.AddEvent'. This method previously had three arguments: x, y, symindex. Now it has two: shape and symindex. Rewrite each found line accordingly.
- Determine if the project uses the old aelegend.ocx ArcExplorer control. Replace it with the new control that comes with the ArcExplorer components of MapObjects 2.0, mo2legend.ocx. In the code, replace 'AELegend.' with 'MO2Legend.'
- Determine if the project uses the old scalebar.ocx ArcExplorer control. Remove it and replace it with the new scalebar.ocx file that comes with MapObjects 2.x. No code search-and-replace is needed.
- If the application is a map server using MapObjects Internet Map Server (MOIMS), determine if the Project References aeserver.dll. If so, contact ESRI Developer Support (firstname.lastname@example.org) to obtain the latest version of this DLL. Then, in your application's code, replace the 'AEServer.' library reference with 'AEServerMO2'.
- Check the Project References for DAO libraries prior to version 3.5. Determine if MapObjects is the only component in the application that uses DAO. If it is, turn off the old references and turn on the DAO 3.5x library reference. If parts of the application, other than MapObjects, use DAO versions prior to 3.5x, leave the old references turned on.
- Check the project's References and Components dialogs for other components that may refer to or include objects and controls from MapObjects 1.x. You will need to upgrade and recompile those libraries and controls. Replace the old ones with the new ones.
- Re-package the application for deployment onto other machines. For detailed instructions on how to do this, refer to the booklet that came with the software called: "Building Applications with MapObjects", Chapter 9.
The conversion of your project should now be complete. You may also want to consider redesigning and rewriting other parts of the application to take advantage of the new functionality available in this new version:
· Advanced geometric operations
· Linear measures, routing, and dynamic segmentation
· New symbol renderers
· Map projections
· Reading external tables without needing to data join to a map
· New vector data format support (CAD, VPF, etc.)
· New image data format support (MrSID, GIF, JPEG, etc.)
· ArcSDE transactions
· ArcSDE API direct calls
· New tracking support for shapes other than points
· Easier shapefile exporting
· Image transparency
· Map rotation
· Map layer recordset filtering
· and others