PDA

Click to See Complete Forum and Search --> : how can i call a c++ dll i made in vc++ in visual basic


Jan 10th, 2000, 07:25 AM
i've made a c++ dll, and im trying to make it work in visual basic, in c++ the dll has a char [255] and int data types. please help..

------------------
DeViLdiGGeR
;)

MartinLiss
Jan 10th, 2000, 08:47 AM
You'll need to declare a Function like this one which is used with a dll named RWTGetData, but modified for your dll location and fields passed by the dll.

Public Declare Function RWTGetData Lib "c:\rqt\dbacc.dll" (ByVal sData As String, ByRef nErrCode As Long, ByVal sErrText As String) As Long


I don't think the Ints passed by the dll will be a problem, but the chars will probably need to be handled as follows:


Dim sData as String
Dim lRC As Long
Dim sData as String
Dim sErrText as String

sData = String(255, 0)
sData = Space(MAXLEN)
lRC = RWTGetData(sData, lError, sErrText)



------------------
Marty

Fox
Jan 10th, 2000, 09:58 PM
AFAIK there's an API command for running dll's...

You can also call dll's using 'RunDll.exe' found in your windows dir. (But I don't know how to send arguments to the called function.. if anyone could help me, will be great.)



------------------
Fox
gigotz@gmx.net
http://gigotz.tsx.org
...
Every program can be reduced to one instruction which doesn't work.