I noticed some users who run a program that tries to call a C dll (compiled with vs2005) in VB (6.0) they get a mysterious "file not found error".
Can anyone try to help me pinpoint what would cause such an error?
Calling C dlls in VB?
Option Explicit
'Declare the c++ dll. In the real world you will probably do this
'in a module. Note the path to your dll might be different than mine.
'Also note that the values are being passed ByVal
Private Declare Function MyFunction Lib _
"c:\pub\sampleproj\debug\SampleProj.dll" (ByVal szString As String, _
ByVal nFirstNum As Long, ByVal nSecondNum As Long) As Long
Private Sub Form_Load()
Dim lngResults As Long
'call the function. It should display a messagebox with the string
'which will originate from the dll, and then another messagebox
'from vb with the total of our two longs
lngResults = MyFunction("This is a test.", 5, 4)
MsgBox "The total is " %26amp; CStr(lngResults)
Unload Me
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment