Add Original SDK
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
' !! this file should not be modified
|
||||
|
||||
Attribute VB_Name = "Module1"
|
||||
' API functions
|
||||
Declare Function DCGetInfo Lib "DinkeyChange.dll" (ByVal type_mask As Long, ByVal model_mask As Long, ByVal prodcode_mask As Any, ByVal array_length As Long, _
|
||||
num_found As Long, type_array As FixedIntegerArray, model_array As FixedIntegerArray, prodcode_array As FixedByteArray, dongle_number_array As FixedIntegerArray, update_number_array As FixedIntegerArray) As Long
|
||||
Declare Function DCGetDiagnosticInfo Lib "DinkeyChange.dll" (ByVal DiagFileName As Any) As Long
|
||||
Declare Function DCDoUpdateCodeString Lib "DinkeyChange.dll" (ByVal UpdateCode As Any, confirmation_code As Long, extended_error As Long) As Long
|
||||
Declare Function DCDoUpdateCodeFromFile Lib "DinkeyChange.dll" (ByVal UpdateCodeFile As Any, confirmation_code As Long, extended_error As Long) As Long
|
||||
Declare Function DCRestoreDinkeyFDLite Lib "DinkeyChange.dll" () As Long
|
||||
Declare Function DCGetMachineID Lib "DinkeyChange.dll" (machineID As Long, extended_error As Long) As Long
|
||||
Declare Function DCDownloadTempSoftwareKey Lib "DinkeyChange.dll" (ByVal machineID As Long, extended_error As Long) As Long
|
||||
Declare Function DCDownloadDemoSoftwareKey Lib "DinkeyChange.dll" (ByVal machineID As Long, ByVal ProdCode As Any, ByVal model As Long, extended_error As Long) As Long
|
||||
|
||||
' maximum number of USB dongles that can be attached to a machine at any one time
|
||||
Public Const MAX_USB_DEVICES = 128
|
||||
|
||||
' mask values
|
||||
Public Const TYPE_MASK_PRO = 1
|
||||
Public Const TYPE_MASK_FD = 2
|
||||
Public Const TYPE_MASK_ALL = (TYPE_MASK_PRO Or TYPE_MASK_FD)
|
||||
|
||||
Public Const MODEL_MASK_LITE = 1
|
||||
Public Const MODEL_MASK_PLUS = 2
|
||||
Public Const MODEL_MASK_NET = 4
|
||||
Public Const MODEL_MASK_ALL = (MODEL_MASK_LITE Or MODEL_MASK_PLUS Or MODEL_MASK_NET)
|
||||
Public Const MODEL_MASK_DEFAULT = (MODEL_MASK_PLUS Or MODEL_MASK_NET)
|
||||
|
||||
' type values for DCGetInfo (returned in the array)
|
||||
Public Const TYPE_PRO = 1
|
||||
Public Const TYPE_FD = 2
|
||||
|
||||
' model values for DCGetInfo (returned in the array)
|
||||
Public Const MODEL_LITE = 1
|
||||
Public Const MODEL_PLUS = 2
|
||||
Public Const MODEL_NET5 = 4
|
||||
Public Const MODEL_NETU = 7
|
||||
|
||||
' model values for DCDownloadDemoSoftwareKey
|
||||
Public Const SWKEY_MODEL_DEFAULT = &HFFFFFFFF ' NB this assumes that the Demo Software Key Template was created with only one valid dongle model
|
||||
Public Const SWKEY_MODEL_PRO_LITE = 0
|
||||
Public Const SWKEY_MODEL_PRO_PLUS = 1
|
||||
Public Const SWKEY_MODEL_PRO_NET = 2
|
||||
Public Const SWKEY_MODEL_FD_LITE = 3
|
||||
Public Const SWKEY_MODEL_FD_PLUS = 4
|
||||
Public Const SWKEY_MODEL_FD_NET = 5
|
||||
|
||||
'we need a structure for an array of bytes because otherwise the VB runtime can move the data in-between function calls
|
||||
Type FixedByteArray
|
||||
data(0 To MAX_USB_DEVICES * 9) As Byte ' 9 is the prodcode length (including terminating null)
|
||||
End Type
|
||||
|
||||
' and ints
|
||||
Type FixedIntegerArray
|
||||
data(1 To MAX_USB_DEVICES) As Long
|
||||
End Type
|
||||
|
||||
' this function converts an unsigned integer to a double for display purposes (otherwise it may display the dongle number as a negative number!)
|
||||
Public Function UIntToDouble(ByVal number As Long) As Double
|
||||
UIntToDouble = CDbl(number)
|
||||
If UIntToDouble < 0 Then
|
||||
UIntToDouble = UIntToDouble + 2 ^ 32
|
||||
End If
|
||||
End Function
|
||||
|
||||
' this function gets the index-th prodcode from the array
|
||||
Public Function GetProdCodeFromArray(prodcode As FixedByteArray, ByVal index As Long) As String
|
||||
Dim data As Byte ' this will be a byte of data from array
|
||||
|
||||
index = index - 1 ' so it is 0-based
|
||||
GetProdCodeFromArray = ""
|
||||
For i = 0 To 8
|
||||
data = prodcode.data((index * 9) + i)
|
||||
If data = 0 Then ' stop when we get to the null
|
||||
Exit For
|
||||
Else ' otherwise append character to string
|
||||
GetProdCodeFromArray = GetProdCodeFromArray & Chr(data)
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
' this function will convert the C string returned in the DCIS to a VB string
|
||||
' e.g. to access the product code use TrimCString(mydcis.prodcode)
|
||||
Function TrimCString(Str As String) As String
|
||||
Dim i As Integer
|
||||
Dim length As Integer
|
||||
|
||||
length = Len(Str)
|
||||
|
||||
For i = 1 To length
|
||||
If Mid(Str, i, 1) = Chr$(0) Then
|
||||
TrimCString = Left$(Str, i - 1) 'take off null and rest of string
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user