I am using a DLL developed using Delphi. I tried calling the function in VB and encounter "AccessViolationException, Attempted to read or write protected memory"
In the main declaration:
Public PortNo As Integer
Public Res, Fun, Use As Integer
Public AreaID As Integer
Public PersonID, BuyCount, Fmt, Alarm, Shut, Tick, Comer As Integer
Public MaxRe As Integer
Public Buy, Power As Double
Public _Buy, nRe As Integer
'*** Declaration of the Function
Declare Auto Function _ReadBuyCard Lib "Sowin.dll" (ByVal _nPortNo As Integer, ByRef AreaID As Integer, ByRef PersonID As Integer, ByRef BuyCount As integer, ByRef Buy As Double, ByRef Format As integer, ByRef Power As Double, ByRef Alarm As integer, ByRef Shut As integer, ByRef MaxTick As integer, ByRef MaxRegrate As integer) As Integer
'*** Calling the function
Res = _ReadBuyCard(PortNo, AreaID, PersonID, BuyCount, Buy, Fmt, Power, Alarm, Shut, Tick, Comer) '*** This is where the error accurs
I have looked up some of suggestions in the internet such as using Byref and playing around with the data types such as int64 etc, but I still have not able to solve the problem.
I appreciate any suggestion.
Thanks