Ich habe mir dazu mehrer Structures anlegen müssen:
Beispiel:
Code: Alles auswählen
STCMENTRYDATA is Structure
mflCtrl is unsigned int // ULONG
mflDependency is unsigned int // ULONG
cMulReserve is int // ULONG
nMcbDataEXPRESS is 4-byte unsigned int
sMabData is ANSI string of 2*256-1 // gnCM_MAX_STRING_LEN
END
PROCEDURE CodeMeterReadDataArray(nProductCode)
stCmAcc is STMY_ACCESS
stCmEntryInfo is STCMBOXENTRY2
nAnzahlLizenzen is int = 0
nItems is int = 10
arrPBuffer is array of STCMENTRYDATA
nHandleCm is int
nRet is int =0
stCmAcc:nMflCtrl = CM_ACCESS_NOUSERLIMIT
stCmAcc:nmulProductCode = nProductCode // Productcode
stCmAcc:nMulFirmCode = 104711 // FirmCode
FOR i = 1 TO nItems // Puffer vorbelegen
ArrayAdd(arrPBuffer)
END
nRet = API("WibuCM32.dll", "CmGetInfo", nHandleCm, CM_GEI_ENTRYDATA, &arrPBuffer, 527*nItems) // WibuCM32.dll sizeof(arrPBuffer)
FOR i = 1 TO nItems // debug print license info to screen
Info(arrPBuffer[i].sMabData)
END
1) wie kann ich die Größe einer structure ermittlen (lenght() funktioniert nicht), also etwas wie sizeof() in C
2) wie kann ich die 265 mit einer Konstante (gnCM_MAX_STRING_LEN ) ersetzen:
sMabData is ANSI string of 2*256-1 // gnCM_MAX_STRING_LEN
also:
gnCM_MAX_STRING_LEN is int=256
sMabData is ANSI string of 2*gnCM_MAX_STRING_LEN -1 // funkt aber nicht.
unter Xbase++ war das einfach ein #define