Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created a windows forms application called ODTuner. It was written in vb.net using VS2010. I am attempting to get an object reference to a running instance of this application from a plugin I'm writing for another application. However, when the assignment is made:

Dim odt as Object
odt = GetObject(, "ODTuner.Application")

I get an error saying, "Object variable or With block variable not set" If I execute it from a VBScript using CreateObject, I get an error saying, "ActiveX Component can not create object."

Now, I believe I have the appropriate attributes set in ODTuner as follows:

<comvisibleattribute(true),> Guid("896746B9-ECEE-4EB3-9DB7-BAC2D318D07C"), _
ProgId("ODTuner.Application"), _
ClassInterface(ClassInterfaceType.None)> _
Public Class ODTuner

At first, I thought it must not be getting registered properly, even though the ComVisibleAttribute is set to true, and "Make Assembly COM Visible" is checked in AssemblyInformation. When logged in as an administrator, I searched the registry and did find it registered there with the correct GUID under Computer\HKEY_CLASSES_ROOT\. Oh, I have also tried registering it manually using regasm.

So, my question is, if it does appear in the registry, why am I getting an error. I did find a post somewhere that said that you cannot use GetObject to get an object reference to a class created in Visual Basic (it did not mention .NET specifically). This does not make sense to me, but if it is true, how do you get an object reference to a class created in VB?

I have the feeling that I changed something manually in VS that it handles automatically, and corrupted something, but I have searched and searched and cannot figure out why this does not work.

Any help would be appreciated. I have been stuck on this too long already.

Update: The "Object variable or With block variable not set" error was caused by a different problem. The correct error message is "Cannot create ActiveX component."

odt = CreateObject("ODTuner.Application"

OR

odt = GetObject(, "ODTuner.Application")

both give this error.
Posted
Updated 4-Oct-13 7:33am
v3
Comments
Bernhard Hiller 4-Oct-13 4:40am    
Do you want to use that ODTuner application as an OutProc COM server?
Also take care of 64bit/32bit issues on 64bit systems.

1 solution

Try registering the third party activex component.
 
Share this answer
 
Comments
Member 10297511 6-Oct-13 13:50pm    
Not sure what you are suggesting to register? My application is registered, but I get the "Cannot create ActiveX Component" error no matter where I try to run it from. I am writing a plugin for a 3rd party app, but even if I create a simple vbscript and try to run it from there using CreateObject or reference it using GetObject, I still get the error. That was a very long way of saying I don't think the error has anything to do with the 3rd party app.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900