Solved

Running Object Table Visibility

Posted on 2008-10-10
5
736 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.

738 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