Product: MapX
Version: 3.52
Platform: All Windows Platforms
Category: Errors
Summary:
Delphi 3 MapX example on the MapInfo web site.
Question:
The Delphi 3 MapX example on the MapInfo web site will not compile. What must be done for it to run properly?
Answer:
Due to significant changes between Delphi 2 and Delphi 3, the following changes will allow the Delphi 3.0 web sample to work correctly.
If a class not registered error is received, change the prototype and declaration for the Map1RequestData procedure to the following (the parameter types have changed):
procedure Map1RequestData(Sender: TObject; const DataSetName: WideString;
Row: Integer; Field: Smallint; var Value: OleVariant;
var Done: Wordbool);
Upon compiling, if an OleAuto.dcu or Ole2.dcu not found message is received, go to the delphi3/lib/delphi2 directory, and copy these files to delphi/lib/.
Lastly, if a 'not enough actual parameters' error on compilation is received, add the following line to the public declarations section:
vEmpty: Variant;
Then, on each called method where the error occurs, add vEmpy for each parameter not used such that all parameters have a value. Examples follow:
from mainunit:
ds := Map1.Datasets.Add(miDataSetODBC, param, vEmpty, vEmpty, vEmpty, vEmpty, vEmpty, vEmpty);
from LyrCntrl:
mainunit.mapform.map1.layers.add(openDialog1.FileName, vEmpty);
If an error is thrown during Datasets.Add method, this is likely the culprit, and the below needs to be added to handle this exception:
Uses ActiveX
vEmpty: OleVariant;
// Initialize variable for not used arguments in MapX functions
TVarData(NotParm).VType := VT_ERROR;
TVarData(NotParm).VInteger := DISP_E_PARAMNOTFOUND;
Last Modified: 09/14/1999 03:34:53 PM
|