Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2005

Tip: Looking for answers? Try searching our database.

Troubleshooting DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Damon Heron - 27 Jan 2005 01:30 GMT
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
Andi Mayer - 27 Jan 2005 07:22 GMT
>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?
---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
Damon Heron - 27 Jan 2005 22:54 GMT
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

>>Hope someone can point me in the right direction.  I have a barcode
>>scanner
[quoted text clipped - 12 lines]
> first 10 lines in the message
> MW
Andi Mayer - 28 Jan 2005 10:25 GMT
>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

---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.