oursmp Posted February 10, 2005 Posted February 10, 2005 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 Quote
Mike_R Posted February 10, 2005 Posted February 10, 2005 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 don't have any (personal) knowledge about how to use C++ and this really isn't 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. I'm not trying to throw you away! I wish I knew how to do this, but I don't have any C++ experience myself, and this really isn't the right forum for it. Another thought is that you don't 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 don't know how to do this from C++. :( Sorry couldn't do better, Mike Quote Posting Guidelines Avatar by Lebb
twistedm1nd Posted February 10, 2005 Posted February 10, 2005 FYI, though this is not the rifgt forum, a detailed intro to creating a COM component and accessing it via VB and VC++. To do it via c#/VB.Net you;d have to use DllImport as mentioned above by Mike Dr. GUI on Components, COM, and ATL Quote
Recommended Posts