Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-23
4
Medium Priority
?
284 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 375 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

963 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