Select to view content in your preferred language

Using ArcReaderControl (10.0) with Delphi 2010

3653
3
01-28-2011 02:05 AM
AlanTonkin
Regular Contributor
Hi

I recently upgraded from ArcGIS 9.3.1 to ArcGIS 10. With 9.3.1 I had developed a custom ArcReader application using Delphi 2010 without any issues.

After the upgrade to ArcGIS 10, I re-imported the esriPublisherControls object library into Delphi and the component appears under my ActiveX Tool component palette. When trying to place this component on a form I get a "Class Factory could not supply the requested class" error. I tried re-registering the type libraries but this made no difference.

I believe now that in ArcGIS 10, one requires a VBA authorization file. Considering the fact that I had to install the VBA Resources for Developers when I installed ArcGIS 10, do I presume that the reason for not being able to use this component yet is due to the fact that VBA is not authorized on my machine?

Could someone please shed a little light on this for me please.

Thanks.

Alan
Tags (2)
0 Kudos
3 Replies
KarenGreen
Deactivated User
Alan, did you ever resolve this?  I am having the same issues and reading lots of posts but there is never any resolutions posted.
If you resolved it can you remember what you did to fix.

Thanks
Karen
0 Kudos
WilliamMattingly
Emerging Contributor
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;
0 Kudos
AlanTonkin
Regular Contributor
Hi Karen & William,

My apologies for not posting this sooner, but I did find the source of the problem.

It lies in the Windows Registry. If you are familiar with making changes to the registry, see my instructions below:


  1. Open the Windows registry.

  2. Browse to the following key [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4C3033ED-ECF7-4EC1-8712-E6DBE236CD7C}\InprocServer32]

  3. Here you will find a String Value called (Default) and the data is C:\Program Files (x86)\Common Files\ArcGIS\bin\ArcGISVersion.dll

  4. Since the ArcReader control is not a licensed control, this should point to the ArcReader ocx file and not the ArcGISVersion.dll

  5. Change the data for this String Value to be C:\Program Files (x86)\ArcGIS\ArcReader10.1\bin\ArcReaderControl.ocx


I am running ArcGIS 10.1 on a Windows 7 64-bit OS so the registry key and folder specified above will more than likely be different on a 32-bit Windows 7 or Windows XP OS.

If you need any further information, please let me know.
0 Kudos