Solved

Running Object Table Visibility

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

810 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