Home > database >  The pointer of dynamic link library trouble!
The pointer of dynamic link library trouble!

Time:09-26

The dynamic library function description:
The Function "GetBellTime
"[Function] Function "GetBellTime" is 2 get the bell time from the terminal.
[Format] BOOL GetBellTime (Long dwMachineNumber,
Long * dwValue,
Long * dwBellInfo);

[Parameter] dwMachineNumber: ID number of the terminal to delete the registration data from
DwValue: A long -type pointer to the value of the bell count.
Minimum 1: Maximun: 8
DwBellInfo: A long -type pointer to the value of the bell time information.
The data is 24 bytes in size.

[Return Value] It is TRUE when a valid data from the then read from the terminal.
Whenever It FALSE if the terminal does not have the specified data on It or an error from the
Occurred to the communication. The When the return value is FALSE, the values of the parameters
Have no meanings.

//vb demo
Const DataLen=24
Dim mlngBellInfo (DataLen/4 to 1) As Long
Dim vErrorCode As Long

LblMessage. Caption="Waiting... "
DoEvents

If frmMain. Fk528KM1. EnableDevice (mMachineNumber, False)=False Then
LblMessage. Caption=gstrNoDevice
The Exit Sub
End the If

VRet=frmMain. Fk528KM1. GetBellTime (mMachineNumber mBellCount, mlngBellInfo (0))
If vRet=True Then
CopyMemory mBellInfo, mlngBellInfo (0), DataLen
ShowValue
LblMessage. Caption="Success!"
The Else
FrmMain. Fk528KM1. GetLastError vErrorCode
LblMessage. Caption=ErrorPrint (vErrorCode)
End the If
////

Long * dwBellInfo how the parameters of the set? I use a long, long [] are not
Please give directions!

CodePudding user response:

If is the input parameter is long, if is the output parameter is ref long

CodePudding user response:

Brought the ref

CodePudding user response:

DwBellInfo this parameter seems to have when using open up the meaning of a piece of storage space (I feel)

CodePudding user response:

I still post on pb code LongLong ll_bellInfo [5] I tried long integer array directly

//to get equipment timing bell
CONSTANT INTEGER DataLen=24

The Integer li_rt
Long ll_bellTimes
LongLong ll_bellInfo [5]
St_belltime Lst_belltime

If ZDM. Object. GetBellTime (Integer (ist_mcInfo. MacNo), Ref ll_bellTimes, Ref ll_bellInfo [1]), Then the
CopyMemory (Ref Lst_belltime, ll_bellInfo [1], DataLen)
Li_rt=1
F_mainshowmess (ist_mcInfo MacNo + 'number machine for bell time success! ')
The Else
Li_rt=1
F_mainshowmess (ist_mcInfo MacNo + 'failed to get bell time machine: + of_GetLastError ())
End the If

Return li_rt

CodePudding user response:

Try this:

CONSTANT INTEGER DataLen=24

The Integer li_rt
Long ll_bellTimes
LongLong ll_bellInfo
St_belltime Lst_belltime

Ll_bellInfo=0
If ZDM. Object. GetBellTime (Integer (ist_mcInfo. MacNo), Ref ll_bellTimes, Ref ll_bellInfo) Then
CopyMemory (Ref Lst_belltime ll_bellInfo, DataLen)
Li_rt=1
F_mainshowmess (ist_mcInfo MacNo + 'number machine for bell time success! ')
The Else
Li_rt=1
F_mainshowmess (ist_mcInfo MacNo + 'failed to get bell time machine: + of_GetLastError ())
End the If

Return li_rt

CodePudding user response:

Like this and with ref directly long as
Return is True but CopyMemory without data ll_bellTimes is below 0 this I have value in vb followed ll_bellTimes
Thank you
  • Related