How To: Convert MapObjects 1.x Custom Objects to MapObjects 2.x
The following steps outline what you need to do to convert your MapObjects 1.x Custom Object DLL, written in Visual C++, to allow it to run with MapObects 2.x.
- Update the code in both the Custom Object DLL and the application. A. Open a code window.
B. Select Edit > Replace
C. Replace the string 'MapObjects.' with 'MapObjects2.'
D. Repeat the process, replacing 'MoPlus.'with 'MapObjects2.'
- Replace any reference to 'AFCust10' with 'AFCust20'.
- If making function calls into the MapObjects2 OCX – perhaps by creating Dispatch wrapper classes – the Dispatch ID’s for these function calls must be updated. Obtain the correct VTble entry point Dispatch ID for the required function in the 'map.cpp' file supplied in the '..\MFC\Common\' directory. All the MapObjects2.x C++ wrapper classes are in this directory.
- Rebuild the DLL; all applications that use the DLL must also be changed. Modifications to the end-application include:
-Ensuring that the application uses the MapObjects 2.x control.
-Update code to replace 'MapObjects.' with 'MapObjects2.'
-Ensuring that the application references the new, updated Custom DLL.
The MoPlus GroupRenderer and LabelPlacer objects have been incorporated into core MapObjects, but the PathFinder object has not. Therefore, all references to the PathFinder should be removed from the MapObjects 2.0 application.
Both MapObjects 1.x and 2.0 have dependencies on some of the same DLLs, but those DLLs installed by MapObjects 2.0 are a more recent version. To avoid the development environment loading the older DLLs into memory while updating the project, run a MapObjects 2.0 application once before running a MapObjects 1.x application. The more recent DLLs will be loaded into memory, which are backward compatible with MapObjects 1.x, and both MapObjects 1.x and 2.0 applications will run successfully.