As I said, this is just a C-style DLL. It doesn't have type information in it, so you can't add a reference to it. You have to call it like you would a Windows DLL. Put declarations at the top of the module like this:
Declare Function GetNumberOfChannels& Lib "scaleAccess.dll" (x1&)
Declare Function GetChannelNameByIndex& Lib "scaleAccess.dll" (ByVal x1&, ByVal x2$, x3&)
Then, you can call the functions. MSDN has some good information on calling DLL's in Visual Basic under Using Visual Basic->Accessing DLL's in VB
The below code is what I used to test these functions in VB. You would have to change the path to the DLL.
Private Declare Function GetNumberOfChannels Lib "c:\Projects\VB\scaleAccess.dll" _
(ByRef num As Long)
As Integer
Private Declare Function GetChannelNameByIndex Lib "c:\Projects\VB\scaleAccess.dll" _
(ByVal index As Long, ByVal ch As String, ByRef nameLength As Long) As Integer
Private Sub Command1_Click()
Dim num As Long
Dim channelName As String * 255
Dim nameLength As Long
Dim i As Long
GetNumberOfChannels num
For i = 0 To num - 1
nameLength = 255
GetChannelNameByIndex i, channelName, nameLength
channelName = Left(channelName, nameLength)
Next i
End Sub
Best Regards,
Chris Matthews
National Instruments