Travis
Travis

Reputation: 659

Using COM dll with unmanaged c++

I am still a bit new to Windows programming and sometimes find the documentation and tutorials I find confusing and sometimes contradictory but I hope I can make some sense and be corrected on any points I am mistaken about. I am using an API where the documentation included is quite poor. It is made up of a number of DLLs that they envisioned would be added as a reference to VB projects (most of the users are biologists/chemists and are not very familiar with other languages, so they recommend VB). I thought they were .NET dlls at first but they cannot be registered with regasm and a tlb cannot be generated using this but can be registered with regsvr32, so I guess that means they are COM dlls...please correct me if I am wrong.

My understanding is that as this exposes the COM objects that I should be able to use this with .NET languages and unmanged c++. I have used it in C# but I would also like to use this in unmanged c++. I have seen tutorials like this: http://cppkid.wordpress.com/2009/01/...nmanaged-code/ That import the type library but I do not have this, it was not supplied with the API. However using OLE viewer I was able to see that they were available (embedded in the dll?). I was wondering if anyone knows how I can go from this to actually using the dll in c++.

Cheers and thanks for any help.

Upvotes: 2

Views: 873

Answers (1)

yms
yms

Reputation: 10418

I guess the easiest way to achive this would be to use the #import directive:

#import <mygreatlib.dll>

There are other ways though, like using #import with the ProgID of the entry point class of your dll, or using the MFC type library wizard

Upvotes: 2

Related Questions