Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ dll for COM Help

Status
Not open for further replies.

russgreen

Programmer
Dec 7, 2002
86
GB
I am a VB.NET programmer and really no very little about C++. However, I have a lot of code written in C++ and I want to be able to use it in a VB.NET app I am working on.

I have setup a win32 dll project in VC++.NET (2005 express beta), I have added all the .h files to the project and it compiles with success.

I now want to be able to reference this dll into my VB.NET app as a COM or ActiveX dll. What do I need to do to the C++ project to enable this?

I currently haven't coded the functions that I want to expose to my VB.NET app other than a simple test function:

int _stdcall ReportVersion() {
return 1;
}

Please help.

Regards,
Russ

 
I should have said...

I would like to avoid using a def file as I don't really want to declare all the functions in the dll before using them.

Thanks
 
A COM or ActiveX (really the same thing anyway) DLL does not expose individual functions like your ReportVersion function. Instead, you make COM objects and implement the standard COM DLL functions so that apps can use COM to load your DLL and create instances of your COM objects.

The standard COM DLL functions (look them up in MSDN) are:

DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top