I have to migrate code to vb. I am quite sure that I don't have to rewrite the DLLs. All I have to do is call the DLLs in vb6.
How do I call DLL(s) in VB
Register the dll on the machine you will use it on. For performance, you should early bind the dll. To do this,go to Project menu and select references. Check the name of the dll that you want. In your code:
Dim objObjectName as NameOfYouDLL
'after you type 'As' it should bring up the
dll in the intelisense.
set objObjectName = CreateObject("NameOfYouDLL"
'when you are done using it, remove it from memory:
If Not objObjectName Is Nothing then
Set objObjectName = Nothing
End if
If you are not using ActiveX/COM DLLs, and you only want to use exported APIs, then you will need to write Declare statements for each of the APIs that you wish to use. - Jeff Marler B-)
The problem with C DLLs is two-fold. Firstly, if you didn't write them and don't have the source code (or an appropriate type library) then the exercise is not straight-forward at all. The second issue (again assuming no apprporiate type library) is that if the original author did not expect the DLLs to be called by VB they may not have exported compatible function headers.
Assuming that you've beaten both these issues you probably want to have a look at the API Text Viewer to get a feel for how you can make declarations for external DLLs (in the end, all the Win32 API is is a set of DLLs with functions that you can call).
First of all I'd like to say, I'm not responding to this post in particular..
Second.. YOU GUYS ARE THE GREATEST ! When I was at my last job (contract, it ended) -- I found you guys.. you were
an immense help... I LOVE YOU GUYS ! (all senimental and stuff. sniff sniff.)
BTW .. I do have a basic question:
What are DLL's in VBASIC5,6, and how do you use them?
I read in a simple VBASIC5 manual that they were used for
drivers -- and stuff you didn't want in memory all the time
and to be able to reuse them and call them as needed..
but perhaps you could elaborate a little.. . . .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.