COM server registration

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

COM server registration

Postby gbrandt » Wed Mar 03, 2010 1:04 am

I have created a com server using the 'Automation Object' and added a method 'Times10' to the IComObject interface. Windows 7 32 bit, Builder 2010.

I have added no code except to make the Times10 method take a value in and multiply by 10 and put that in a value going out:

Code: Select all
STDMETHODIMP TComObjectImpl::Times10(long inVal, long* outVal)
{
      *outVal = inVal * 10;
}


Everything else is generated code. The code compiles clean and creates an exe and a tlb file. I press the register button on the ridl toolbar and get the message that the ActiveX object has successfully been registered. I have then tried to import the COM object using the menu Component->Import Component. My COM object does not show up on any of the lists provided by the Import Component dialog.

I can't seem to find anything in the help file. Why is my COM object saying its registered but not showing up on the Type Library or ActiveX Control lists in the import component dialog?

I have also tried Project1.exe /REGSERVER but it still does not show up.
I have tried the Add button to import the tlb file or the exe and get a dialog box stating 'Error Accessing the OLE registry'.

Thanks,
Gregor
gbrandt
Top Poster
Top Poster
 
Posts: 41
Joined: Thu Feb 11, 2010 12:45 pm

Re: COM server registration

Postby gambit47 » Wed Mar 03, 2010 6:04 pm

gbrandt wrote:I can't seem to find anything in the help file. Why is my COM object saying its registered but not showing up on the Type Library or ActiveX Control lists in the import component dialog?


Not sure if it still applies in CB2010, but in older versions of the VCL, COM/Automation objects were registered in the HKEY_CLASSES_ROOT key, which is considered bad practice in newer OS versions. It could be that your object is being registered in a way that the import dialog simply cannot find due to permission issues and such.

gbrandt wrote:I have tried the Add button to import the tlb file or the exe and get a dialog box stating 'Error Accessing the OLE registry'.


That would definately imply that a permissions issue is occuring.
Remy Lebeau (TeamB)
http://www.lebeausoftware.org
User avatar
gambit47
BCBJ Author
BCBJ Author
 
Posts: 472
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: COM server registration

Postby gbrandt » Thu Mar 04, 2010 11:16 am

gambit47 wrote:Not sure if it still applies in CB2010, but in older versions of the VCL, COM/Automation objects were registered in the HKEY_CLASSES_ROOT key, which is considered bad practice in newer OS versions. It could be that your object is being registered in a way that the import dialog simply cannot find due to permission issues and such.

gbrandt wrote:I have tried the Add button to import the tlb file or the exe and get a dialog box stating 'Error Accessing the OLE registry'.


That would definately imply that a permissions issue is occuring.


So I should do my COM development under Windows XP, it should all work then? If yes, i suspect the COM component would still work under Windows 7.

That is unfortunate as the Embarcadero spec sheet clearly says develop on any version of windows for any version of windows.
gbrandt
Top Poster
Top Poster
 
Posts: 41
Joined: Thu Feb 11, 2010 12:45 pm

Re: COM server registration

Postby gambit47 » Thu Mar 04, 2010 5:57 pm

gbrandt wrote:So I should do my COM development under Windows XP, it should all work then?


It does not matter which OS you *develop* on, since the same ActiveX/COM framework in the RTL/VCL is being used in the executable. The issue relates to which OS you *deploy* on, and whether the RTL/VCL framework is doing the "right thing" under that OS or not. I don't have any details on that for CB2010 right now, but I know it can sometimes be an issue for apps written in older BCB versions deployed on newer OSes.
Remy Lebeau (TeamB)
http://www.lebeausoftware.org
User avatar
gambit47
BCBJ Author
BCBJ Author
 
Posts: 472
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: COM server registration

Postby gbrandt » Fri Mar 05, 2010 4:27 pm

I tried the same sequence of steps under Windows XP and it worked fine, so this is a Windows 7 issue. I will test later to see if code compiled under for COM works under Windows 7
gbrandt
Top Poster
Top Poster
 
Posts: 41
Joined: Thu Feb 11, 2010 12:45 pm

Re: COM server registration

Postby gambit47 » Fri Mar 05, 2010 5:29 pm

gbrandt wrote:I tried the same sequence of steps under Windows XP and it worked fine, so this is a Windows 7 issue. I will test later to see if code compiled under for COM works under Windows 7


XP was less restrictive on Registry access than Vista+ are. I suggest you run a Registry monitor during installation to see exactly what is being stored where. That will tell you if/how Win7 is interferring with the registration. Most likely, some of the registration values are being virtualized to other areas of the Registry.
Remy Lebeau (TeamB)
http://www.lebeausoftware.org
User avatar
gambit47
BCBJ Author
BCBJ Author
 
Posts: 472
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: COM server registration

Postby gbrandt » Fri Mar 05, 2010 5:45 pm

I suspect you are correct, I filed a bug with QC because the functionality is different in XP vs 7.

Thanks,
Gregor
gbrandt
Top Poster
Top Poster
 
Posts: 41
Joined: Thu Feb 11, 2010 12:45 pm

Re: COM server registration

Postby gbrandt » Wed Mar 10, 2010 10:18 am

gbrandt wrote:I suspect you are correct, I filed a bug with QC because the functionality is different in XP vs 7.



Final post on this. On first run of Builder 2010 on Windows 7 I got a dialog that said Builder needed to be run with some 'compatibility flags' set. Of course there was no list of what those flags were. This apparently caused some problems, not with the COM registration, but with the Component from COM feature.

A full reinstall of Windows 7, making my user Administrator and turning off UAC, then an install of Builder 2010 fixed the problem.
gbrandt
Top Poster
Top Poster
 
Posts: 41
Joined: Thu Feb 11, 2010 12:45 pm


Return to Technical

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron