Spinterface. dll
Upstream receiving function: getcngpdeliversm
Problem description: This development kit is developed for DELPHI6, which uses a data type that is not directly supported by VB and. Net such as pchar, which requires certain conversion.
The following is an example of VB. NET 2005 development code:
Definition:
Imports system. runtime. interopservices
Private declare function getcngpdeliversm lib "sp_interface.dll "(_
<Financialas (unmanagedtype. vbbyrefstr)> byref smsgid as string ,_
Byref bymsgformat as byte ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref srecvtime as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref sorgaddr as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref sdestaddr as string ,_
Byref bymsglen as byte ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref smsgcontent as string ,_
Byref byprovalue as byte ,_
Byref byisreport as byte ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref ssrcmsgid as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref ssubmitdate as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref sdonedate as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref sStatus as string ,_
Byref ideliverackresult as int32 ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref link_id as string ,_
<Financialas (unmanagedtype. vbbyrefstr)> byref beneficiaryid as string) as int32
Early-Stage indicators
Public sub XX ()
Dim result as int32
Dim smsgid as new string (CHR (0), 10)
Dim bymsgformat as byte = 0
Dim srecvtime as new string (CHR (0), 14)
Dim sorgaddr as new string (CHR (0), 20)
Dim sdestaddr as new string (CHR (0), 20)
Dim bymsglen as byte = 0
Dim smsgcontent as new string (CHR (0), 254)
Dim byprovalue as byte = 0
Dim byisreport as byte = 0
Dim ssrcmsgid as new string (CHR (0), 20)
Dim ssubmitdate as new string (CHR (0), 10)
Dim sdonedate as new string (CHR (0), 10)
Dim sStatus as new string (CHR (0), 7)
Dim ideliverackresult as byte = 0
Dim link_id as new string (CHR (0), 20)
Dim beneficiaryid as new string (CHR (0), 21)
End sub
Detailed description:
Although the input parameters also have the pchar type in the downlink, the string type can be expressed and recognized by the system. We do not need to convert the data by ourselves, other types can be represented by the byte and int32 types in the development document.
Because pchar is a pointer reference in the uplink, such as byref or output, which is passed by reference, you need to host a pointer conversion from code to unmanaged code, so you can use unmanagedtype. vbbyrefstr performs "Features", indicating that the conversion is the same for C #, as if. net1.1 does not support this item, and I have never studied it.
In addition to this item, the memory space must be allocated. Here I use new string (CHR (0), 100) to indicate that the next 100 is the character length, which is the fixed length.