Solved

C++ COM Object can be instantiated using NEW in VB but not using CreateObject()

Posted on 2004-09-23
4
276 Views
Last Modified: 2013-11-25
Dear all experts,

I managed to create an ATL COM dll in VC.NET 2003. So far it works and registers as designed. Handy Dandy.

Now I tried testing the dll in VB (6) using this code:

Dim a As New DecodeKL
MsgBox (a.GetApplicationCode(1234, "5678"))

However this approcach:

set a = CreateObject("DecodeKL")

results in "ActiveX Component can't create object".

I know I must be missing something obvious in the creation of my interface and CoClass - I just don't find it.

Here's how I started this project:

New ATL Project
Add Class -> ATL Simple Object
On the Interface it created "Add Method"
and then fill the method with code.

What am I missing?

Thanks, Nick
0
Comment
Question by:nick601
  • 2
  • 2
4 Comments
 

Author Comment

by:nick601
ID: 12133920
I should add that I need to be able to use CreateObject() because this dll is meant for use on an ASP web server. So NEW is not an option there.

Nick
0
 
LVL 19

Accepted Solution

by:
drichards earned 125 total points
ID: 12135797
The registered ProgID is usually <ProjectName>.<ComponentName>, so check the registry for <name>.DecodeKL where <name> is the name of the project which contains teh COM object.
0
 
LVL 19

Expert Comment

by:drichards
ID: 12135809
'new' works because you have evidently referenced the COM dll in your VB and it knows where to look.
0
 

Author Comment

by:nick601
ID: 12135848
As I said - something obvious - thanks DRichards!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

707 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

18 Experts available now in Live!

Get 1:1 Help Now