views:

441

answers:

2

What is the simpliest way to use a C++ header file in a vb.net application? I need to access an API defiend via the header file for a custom VB.NET windows app.

+1  A: 

Use the VB.NET Declare statement to redeclare the API function in your code. This will not work if the header file contains classes, you'll need to write a wrapper to make those usable.

Hans Passant
+1  A: 

Use the PInvoke Interop Assistant to convert the C++ header into PInvoke declarations.

If you have the full source code for the C++ project use C++ Interop as advised by whunmr.

MarkJ
MarkJ, thank you for your reply to this question! I can only hope schooner decides to go back and mark this as the answer. The SigImp Translate Snippet tab of the PInvoke Interop Assistant saved me an awful lot of time!
Brad