-
hey, (like the subject line..lol)
i am having a bit of a problem with using my own DLL's in vb, I wrote it in VC++, and am trying to use it in vb, but i keep getting the error:
"Cant find DLL entry point in..."
now do you have any idea why this does that? Do you need to reference it or something? All i am doing to connect it to VB is add:
Code:
Private Declare Function add Lib "DLLTest.dll" (y As Integer, x As Integer) As Integer
in the general declarations, is this wrong? I dunno...
thanks
-
It all depends on what sort of Dll it is.
First off though. Is the dll Registered on the system?
Next if it is an ActiveX or COM dll you should be able to reference the dll as an object, and use the dll like any other object in VB. You can create an instance of it using the CreateObject function, or use the New keyword when declaring it.
Good Luck.
-
thanks...
erm it is a standard win32 dll made in VC++6, and so doesnt need registering, I have it in the applications folder, and it wont work, pls help me, i am desperate, well sorta! i am bored and want to do this, everytime that i make dlls i cant use them in vb (unless i make them in vb) so what am i doing wrong, i can use the dll in a console C++ app.. ??? :(
-
-
Can you post your C/C++ function prototype, please?
-
Here is my simple function:
Code:
DLLTEST_API int add(int num1, int num2)
{
return num1+num2;
}
and i have declared it in the header as follows:
Code:
class DLLTEST_API CDLLTest {
public:
CDLLTest(void);
// TODO: add your methods here.
DLLTEST_API int add(int num1, int num2);
};
-
Has anyone else made or used DLL's made in other languages, or made as win32 DLLs? And did you get them to work in vb?
-
I use a C++ dll in my VB program with no problem. I know very little about VC++, but I'm going to try and find the source and see if I can tell what the difference is with your code, but don't hold your breath.
-
The problem is that your function is inside a class, and consequently does not class (sorry :)) as an entry point. If you used:
Code:
__declspec(dllexport) int test(int x, int y) {
return x + y;
}
And put the function into your .def file, it should work. VB has difficulty using C++ classes like that.
-
cant you just add a reference to the file through the project menu and then initiate the class through code, like I do with my VB dll's?
-
THANKS, i am sure it will work now, it is just i dont have a .def file?
-
It's a list of functions in your DLL. It's compiled in when you create it, I think.