Troubleshooting DLL

D

Damon Heron

Hope someone can point me in the right direction. I have a barcode scanner
that uses a dll. In VS, I was able to write a VB program that reads the
scanner. What I would like to do is use it from Access. I copied the
function declarations to a module in Access, but it doesn't seem to read the
port. The dll is in the same folder as the mdb. I have no idea how to
proceed from here. Here is the module:

Module CSP2Module

Public RetStatus As Integer
Public AsciiMode As Integer
Public RTCMode As Integer
Public tempstring(100) As Byte
Public CodeTypeStr(25) As Byte
Public TimeStampStr(25) As Byte
Public PacketLen As Integer
Public Lp1 As Integer
Public i As Integer
Public mystring As String
Public port As Integer
Public portsel As String
Public CommStarted As Boolean = False
Public buf(10) As Byte
Public Lp2 As Integer
Public c As String = ":"
Public T1, T2 As Date
Public mylist(500) As String


'// Communications
Declare Function csp2Init Lib "csp2.DLL" (ByVal nComPort As Integer) As
Integer
Declare Function csp2Restore Lib "csp2.DLL" () As Integer
Declare Function csp2WakeUp Lib "csp2.DLL" () As Integer
Declare Function csp2DataAvailable Lib "csp2.DLL" () As Integer

'// Basic Functions
Declare Function csp2ReadData Lib "csp2.DLL" () As Integer
Declare Function csp2ClearData Lib "csp2.DLL" () As Integer
Declare Function csp2PowerDown Lib "csp2.DLL" () As Integer
Declare Function csp2GetTime Lib "csp2.DLL" (ByRef aTimeBuf As Byte) As
Integer
Declare Function csp2SetTime Lib "csp2.DLL" (ByRef aTimeBuf As Byte) As
Integer
Declare Function csp2SetDefaults Lib "csp2.DLL" () As Integer

'// CSP Data Get
Declare Function csp2GetPacket Lib "csp2.DLL" (ByRef stPacketData As
Byte, ByVal lgBarcodeNumber As Integer, ByVal maxLength As Integer) As
Integer
Declare Function csp2GetDeviceId Lib "csp2.DLL" (ByRef szDeviceId As
Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2GetProtocol Lib "csp2.DLL" () As Integer
Declare Function csp2GetSystemStatus Lib "csp2.DLL" () As Integer
Declare Function csp2GetSwVersion Lib "csp2.DLL" (ByRef szSwVersion As
Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2GetASCIIMode Lib "csp2.DLL" () As Integer
Declare Function csp2GetRTCMode Lib "csp2.DLL" () As Integer

'// DLL Configuration
Declare Function csp2SetRetryCount Lib "csp2.DLL" (ByVal nRetryCount As
Integer) As Integer
Declare Function csp2GetRetryCount Lib "csp2.DLL" () As Integer

'// Miscellaneous
Declare Function csp2GetDllVersion Lib "csp2.DLL" (ByRef szDllVersion As
Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2TimeStamp2Str Lib "csp2.DLL" (ByRef Stamp As Byte,
ByRef value As Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2GetCodeType Lib "csp2.DLL" (ByVal CodeID As
Integer, ByRef CodeType As Byte, ByVal nMaxLength As Integer) As Integer

'// Advanced functions
Declare Function csp2ReadRawData Lib "csp2.DLL" (ByVal aBuffer As
String, ByVal nMaxLength As Integer) As Integer
Declare Function csp2SetParam Lib "csp2.DLL" (ByVal nParam As Integer,
ByRef szString As Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2GetParam Lib "csp2.DLL" (ByVal nParam As Integer,
ByRef szString As Byte, ByVal nMaxLength As Integer) As Integer
Declare Function csp2Interrogate Lib "csp2.DLL" () As Integer

'// Returned status values...
Public Const STATUS_OK As Integer = 0
Public Const COMMUNICATIONS_ERROR As Integer = -1
Public Const BAD_PARAM As Integer = -2
Public Const SETUP_ERROR As Integer = -3
Public Const INVALID_COMMAND_NUMBER As Integer = -4
Public Const COMMAND_LRC_ERROR As Integer = -7
Public Const RECEIVED_CHARACTER_ERROR As Integer = -8
Public Const GENERAL_ERROR As Integer = -9
Public Const FILE_NOT_FOUND As Integer = 2
Public Const ACCESS_DENIED As Integer = 5

'// Parameter values...
Public Const PARAM_OFF As Integer = 0
Public Const PARAM_ON As Integer = 1

Public Const DETERMINE_SIZE As Integer = 0
End Module


Thanks in advance for any advice

Damon
 
A

Andi Mayer

Hope someone can point me in the right direction. I have a barcode scanner
that uses a dll. In VS, I was able to write a VB program that reads the
scanner. What I would like to do is use it from Access. I copied the
function declarations to a module in Access, but it doesn't seem to read the
port. The dll is in the same folder as the mdb. I have no idea how to
proceed from here. Here is the module:


is the "csp2.DLL" registered with regsvr32?
or
have you tried to put it into the references in Access?
 
D

Damon Heron

Its my understanding that this dll does not need to be registered, since it
is not ActiveX. In references, msg is "Cant add a reference to specified
file".

Any other ideas?

Damon
 
A

Andi Mayer

Its my understanding that this dll does not need to be registered, since it
is not ActiveX. In references, msg is "Cant add a reference to specified
file".

Any other ideas?
what's happend if you try to use one of this functions?

BTW : add Public in front of it to show it's a public function, it
helps with reading
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top