Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-23
4
Medium Priority
?
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

722 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