I have a workaround while awaiting ESRI to correct problem. The ArcReaderControl wants to be bound (just like standalone applications) to a version of ArcObjects. (This breaks all rules of ActiveX Tool design). Because we are in an IDE, you dont have any opportunity to BIND and thus dropping the ArcReaderControl on the IDE fails. The same goes for runtime since the TArcReader control is loaded from the DFM. It loads before you have any chance to initialize and you get the error described in the Thread
.
As a workaround, I have moved the TArcReaderControl out of the DFM and I am adding the control at Runtime. This gives me the chance to create the IArcGisVersion object, Bind it to the 10.1 release, then create the ArcReaderControl. This is very much a rig, but works. Because I trap the creation of the IArcGISVersion object, the code is backwards compatible with 9.3.1 as well. The Arc1:TArcReaderControl object is moved from published to Public and I removed all references of ArcReaderControl from the DFM. The following procedure is then called in the OnActivate event to setup the ArcReader Control.
procedure TForm1.CreateARControl;
var
mypversions:IEnumVersions;
pcode:EsriProductCode;
ppath,pver:WideString;
mysucc:WordBool;
begin
try
//Special ArcGis 10.0 Stupid Bind operation now requried
try
AGVersion := createcomobject(class_VersionManager) as IArcGISVersion;
AGVersion.GetVersions(mypversions);
mypversions.Next(pcode,pver,ppath);
while pcode <> esriArcGisDesktop do
mypversions.Next(pcode,pver,ppath);
aGVersion.LoadVersion(pcode,pver,mysucc)
except
end;
//Try to Create TArcReaderControl
Arc1 := TArcReaderControl.Create(Self);
with Arc1 do
begin
Arc1.Parent := Panel1;
Left := 23;
Top := 53;
Width := 762;
Height := 428;
Align := alClient;
TabOrder := 5;
OnMouseDown := arc1MouseDown;
OnAfterScreenDraw := arc1AfterScreenDraw;
OnMouseUp := arc1MouseUp;
OnMouseMove := arc1MouseMove;
OnKeyDown := arc1KeyDown;
end;
except
end;
end;