Solved

Running Object Table Visibility

Posted on 2008-10-10
5
730 Views
Last Modified: 2013-11-10
I have a straightforward COM object (implemented in Delphi 6 if that makes a difference). This uses RegisterActiveObject() to register itself in the ROT, and all works fine for standard WIN32 apps. The first instance of the object needs to be created but after that GetActiveObject() works fine and a single instance of the object works for everybody.
Now I have someone who wants to use this from a C# application. He says that if the object is already out there then he can't use GetActiveObject() and that he can't see it in the ROT. OTOH if he creates the object in his own code then further instances via GetActiveObject() work OK (and now he can see it in the ROT). Anyone know whats going on here? And what do I have to do to make the initial (non-C# created) instance visible for him?
0
Comment
Question by:mikrobe
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 22687142
As far as I'm aware RegisterActiveObject() does not enter the object in the reistry but only on the local object table. Therefore only the CLSID is available. Accordingly I'd expect the C# callerof GetActiveObject to use the CLSID. Is that the case?
0
 

Author Comment

by:mikrobe
ID: 22687871
Yes, he's using the CLSID to get hold of the object. Also to do the CoCreateInstance() that he has to use to create a new instance if he can't find one out there already. The create works so he seems to have the right CLSID, and once he's created his own then he can do the GetActiveObject() with no problems (and can see the object in the ROT from his part of the world). The problem we are trying to solve is when the first instance is created outside of C# in the 'normal' Windows world by (say) a Delphi app. This app can create the first instance and further executions of the Delphi app can use GetActiveObject(). But the C# app can't see it and has to create its own before it appears in the ROT as seen from there. It's almost as if we are looking at two separate versions of the ROT??
0
 
LVL 27

Expert Comment

by:BigRat
ID: 22701353
So, it seems that, since one can create an object with CoCreateInstance, we have a full registry entry.

BUT once a "universal" object has been created the GetActiveObject() returns nothing.

Next question - what exactly is being fed into GetActiveObject() under C#; The CLSID?
0
 

Accepted Solution

by:
mikrobe earned 0 total points
ID: 22701389
This is now at least partially cleared up. It turns out that although the object is not visible when he tests this in the C# environment, if he runs his compiled program in the real world outside then everything works as expected, so his (and my) code is basically OK. Why it's like this I don't know, but the people using his program are going to be real world as well, si it's not a blocking problem.
0
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 25 total points
ID: 22701436
Hmmm, interesting. I could just imagine having a second ROT for testing purposes, since C# code is dymanically interpreted it is easy to do such tricks.

Still, glad you found what was wrong. Ask for a point refund.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question