Update MapObjects sample code from Borland C++ Builder 5.0 to 6.0


There are several major changes from Borland C++ Builder (BCB) 5.0 to version 6.0. As a result, the sample code does not compile properly using MapObjects without code modifications. Below are the major changes that need to be applied.

There may be more changes applicable to Borland C++ Builder 6.0. For more information, please refer to the product's online help or the Borland Web site.

IMPORTANT: The latest version of Borland C++ Builder, which is fully supported for use with MapObjects 2.1-2.4, is version 5.0. For those developers who must use version 6.0 instead of version 5.0, while we hope the information in this document is found to be helpful, as it contains some lessons-learned from developers using version 6.0, ESRI can provide no assurance that developers will not experience other problems when using MapObjects in that environment.

Borland C++ Builder version 6.0 is an unsupported development environment for use with MapObjects-Windows Edition versions 2.1 through 2.4.


  • TypeLib Importer change:
    In BCB 6.0, by default, unlike BCB 5.0, IDispInterface is not used to create COM wrapper classes. Thus, no CoClasses are generated in the wrapper class so the following code fails compilation.

    IMoDataConnectionDisp dc = CoDataConnection::Create();

    Before importing MapObjects into BCB 6.0, click the 'Use dispInterfaces in control wrappers' check box under Tools > Environment Options > Type Library. If MapObjects has already been imported without turning on this option, remove the imported MapObjects class by deleting 'Borland User Components', the default location where MapObjects wrapper class resides in BCB, from Components > Install Packages.
  • Path name change:
    When BCB 6.0 opens projects written in BCB 5.0, it performs an automatic project file upgrade. However, this upgrade operation does not update path names pointing to old libraries or package files. When compiling the project in BCB 6.0, the compiler still seeks the libraries in the old locations. As a remedy, use a text editor, such as Notepad, to open the .bpr file and replace all instances of 'CBuilder5' with 'CBuilder6'.
  • Variant type variable change:
    In previous versions of C++Builder, the Variant RTL class made direct calls into the Windows Variant API. The Variant class now makes calls through the Variant routines in Variants.pas. As a result, many conversion operators converting between build-in types and Variant are not available, so the explicit type case has to be done manually. For example:

    IMOFieldPtr fld = flds->Item("ID"); //5.0
    IMOFieldPtr fld = flds->Item(Variant("ID")); //6.0

    Map1->TrackingLayer->Refresh(true, NULL); //5.0
    Map1->TrackingLayer->Refresh(true, Variant(NULL)); //6.0

    renderer.set_Break(i, fld.Value); //5.0
    renderer.set_Break(i, fld.Value.dblVal); //6.0

  • Interface change:
    COM class wrapper used to be implemented with a conversion operator between IDispatch interface and CoClass interface. Now this conversion operator does not exist in BCB 6.0. In many cases, it is not necessary to cast the CoClass to (IDispatch *) as was done in BCB 5.0. For example:

    layer.GeoDataSet = (IDispatch *)GeoData; //5.0
    layer.GeoDataSet = GeoData; //6.0

  • Wrapper class reference change:
    Sometimes, it is necessary to call ControlInterface to invoke COM properties or methods. For example:

    IMoRectanglePtr rect = Map1->Extent; // 5.0
    IMoRectanglePtr rect = Map1->ControlInterface->Extent; // 6.0

    IMoLayersPtr lyrs = Map1->Layers; // 5.0
    IMoLayersPtr lyrs = Map1->ControlInterface->Layers; // 6.0

  • Naming change:
    TypeLib Importer changes the name of some properties. For example, EOF_ is the name of the 'End of File' property in BCB 6.0 rather than EOF in BCB 5.0.

    IMoRecordsetDisp recs;
    recs = MapLayer->SearchShape(p,(SearchMethodConstants)12, Variant(""));
    if (!(bool)recs->EOF_)
    //do the job

Article ID:000006268

  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic