Solved

Running Object Table Visibility

Posted on 2008-10-10
5
713 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now