Solved

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

Posted on 2004-09-23
4
277 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to create an object factory 2 44
Unresolved External Symbols 3 68
How to convert MFC::CString to UTF8 wchar_t* 10 148
object oriented programming comparison 5 55
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

896 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

14 Experts available now in Live!

Get 1:1 Help Now