I have a VB project that loads a C++ DLL. Declare the following module level API functions in your VB project. ' -- Windows API Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long ' -- Public function in C++ DLL Public Declare Function Test Lib "mycdll.dll" Alias "test_vb" () As Long To use the C++ function you can use something like the following. Note: strDLL holds the fullpath to the C++ DLL ' -- Load the dll lngRet = LoadLibrary(strDLL) ' -- Check for success If lngRet <> 0 Then ' -- Run the script Msgbox Test Else MsgBox "Could not load dll '" & strDLL & "'" & DEF_SPACE, vbCritical, DEF_APP_TITLE GoTo PROC_EXIT End If PROC_EXIT: ' -- Clean up If lngRet <> 0 Then FreeLibrary lngRet
T
TheAphextwin
@TheAphextwin