Way to access a C program from a VB.net application

oursmp

Member
Joined
Feb 7, 2005
Messages
5
Hi,
We are working on a .NET project (VB.net). We have a situation in our project where we need to access a C code from our .NET application. We are looking for some help on how to do that. We need to access the C code from the VB.net programs. We are looking for some help on creating a COM component from VC++ by accessing the C code. We do have some theoretical knowledge in this regard, but not able to do it. Some samples would be a great help in this regard.

Thanks in advance
Oursmp
 
Once you correctly create your COM component, it is rather easy to access it via VB.Net. Trivial even.

Creating a COM component is usually done with either VB 6.0 or with C++. Since your original code is C, then C++ is the right way to go... However, I dont have any (personal) knowledge about how to use C++ and this really isnt the right site for how to do this...

I would try Google on terms like "Creating COM with C++" or the like and/or look into C++ and VC++ oriented forums and websites. Im not trying to throw you away! I wish I knew how to do this, but I dont have any C++ experience myself, and this really isnt the right forum for it.

Another thought is that you dont have to make a COM DLL, actually. You can make a regular DLL and access it from VB.Net by using the Declare Statement or the <DLLImport()> Attribute. Each Function and Sub that you intend to use would have to be imported individually this way, so is fine if you have only a few, but could be tedious if you have dozens of them. So if you have a lot of functions that you are going to be using this way, then, yeah, making it into a COM DLL would probably be best.

I just dont know how to do this from C++. :(

Sorry couldnt do better,
Mike
 
Back
Top