Use GetObject with CSExeCOMServer

May 20, 2010 at 1:51 PM

Hi,
I have been trying out your great code samples for CSExeCOMServer for an out of process activex server.
I compiled the CSExeCOMServer project, registered the CSExeCOMServer.exe using regasm and I followed the sample in CSExeCOMClient.vbs which worked great.

My question is how to use VB script GetObject. I tried the following (a modification to your .vbs script) but got an ActiveX error 429  - could not create activex component.

' This works fine i.e. create instance of object.
SET obj = CreateObject("CSExeCOMServer.CSSimpleObject")
' Error 429 occurs here.
SET anotherobj = GetObject(,"CSExeCOMServer.CSSimpleObject")
' call the HelloWorld method that returns a string
MsgBox "The HelloWorld method returns " & anotherobj .HelloWorld

I have done some research on this but there does not seem to be much info for doing this apart from one approach which is to create a VB6 wrapper, which I have not yet tried (I need to get hold of VB6) but would not be as elegant as your CSExeCOMServer approach if only I could use it with GetObject.

My end goal is to create a single instance of the activeX exe object started from a cmd prompt and the same object can be used in different vbscripts.

Any info you can provide would be great.
Many thanks.
Mark

Coordinator
May 22, 2010 at 1:45 AM
Edited May 22, 2010 at 1:48 AM

Hello

I'm happy to know that my CSExeCOMServer is useful to you.

The problem that you saw is explained in this thread:
http://stackoverflow.com/questions/914628/getobject-and-vb6-activex-exe

In the COM server, you would need to register itself in ROT http://msdn.microsoft.com/en-us/library/ms680747(VS.85).aspx. Here is an example that I quickly found on the internet: http://www.dotnet247.com/247reference/msgs/49/245964.aspx.

Please let me know if this works for you.

If you have any feedback of the project, please send them to onecode@microsoft.com

Jialiang Ge

May 22, 2010 at 9:24 PM

Hi,

Thanks for your prompt response

I didn't realise I needed to register on the ROT.

I'll give it a try.

Many thanks.

Coordinator
May 23, 2010 at 7:39 AM

You are welcome. Please let me know if this works for you. Then I will evaluate if it's necessary to add this sample code to CSExeCOMServer.