Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used the Visual C++ > ATL Project wizard to create a COM dll in Visual Studio 2013. I then used the ATL Simple Object Wizard to create an object in that dll with the following names.

C++
Short name: "PT2_B_db" .h file: "PT2_B_db.h"
Class: "CPT2_B_db" .cpp file: "PT2_B_db.cpp"
COM
Coclass: "PT2_B_db" Type: "PT2_B_db Class"
Interface: "IPT2_B_db"

I want to use a CAutoPtr to call methods from my dll class in C++. I was thinking of something like this from my C++ calling project:

CPT2_B_db* pClassObject = new PT2_B_db();
CAutoPtr<cpt2_b_db> spClassObject(pClassObject);
spClassObject->SomeClassMethod();

How do I set this up in the C++ project from which I want to do the calling?
Where do I reference what header files, etc.?


The dll works from my projects that use VBA. I'm searching for the C++ implementation that's analogous to this:
1.) From VBA, I set the Tools > References to include "PT2_BLib".
2.) Then I include the code:

Dim objPT2_B As Object
Set objPT2_B = New PT2_BLib.PT2_B_db
strDoubleValue = objPT2_B.DoubleValueString(dblInputValue, strFormatString)

-and it works just fine. Any help you could give in porting this same VBA functionality to C++ would be appreciated.

Thanks!
Carl Olen
Posted

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