![]() |
Creating DLL in C++ for Visual Basic
Can someone send me a link to a good resource on how to make a C++ DLL that I can access from a Visual Basic app?
|
Re: Creating DLL in C++ for Visual Basic
Check out
http://support.microsoft.com/default...b;en-us;106553 ("HOWTO: Write C DLLs and Call Them from Visual Basic") - this is a pretty comprehensive article on how to do what you want to accomplish. Thanks Shabbir Bhimani |
Re: Creating DLL in C++ for Visual Basic
u'll have to create a new dynamic link library project. After u create this project u'll be prompted on what kinda DLL, just click empty. After that is complete you will have to add the library ws2_32.lib to the project under project-> settings -> link -> object/modules library or the code below will not compile!. u'll now have to add three files to your project, the first being an implementation (.CPP) file, the second an interface/header (.H) file and the third a DEF (allows VB to be able to read the C++ dll function name) file.
Now lets add to the include files the function definitions for the header file. I called the header file for this demonstration c_dll_4_vb.h. Code:
#include <windows.h>pcDomainToResolve - The name of the domain you are inquiring about. szReturnIP -The variable the IP address will be returned to you in. iSize - The length of IP address being returned without the padding. Next you will need to add the implementation of the header file to the .CPP file. Remember that when you add the code to the .CPP file make sure you include the header file name (c_dll_4_vb.h). Code:
c_dll_4_vb.cpp #include "c_dll_4_vb.h"Code:
c_dll_4_vb.def LIBRARY c_dll_4_vbhappy programmin... |
Re: Creating DLL in C++ for Visual Basic
hian great buddy
thanks for this piece of information. |
Re: Creating DLL in C++ for Visual Basic
Hi,
As I understood the .def file must have the code (without the name of the file at the beginning?): LIBRARY c_dll_4_vb DESCRIPTION 'A C++ dll that can be called from VB' EXPORTS Resolve_Name_To_Ip @1 Is this correct? But if we have more functions, must we add @2, @3, @4...etc...? Kind regards, J. Kepler |
| All times are GMT +5.5. The time now is 18:15. |