Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to understand struct in DECLARE
Message
De
25/10/2010 02:51:12
 
 
À
25/10/2010 02:27:31
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01486804
Message ID:
01486808
Vues:
67
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all,
>
>I'm commit that I'm totaly blind on this.
>
>I have two functions from an DLL that I need to access. Both work with structs, but I do not realy have an idea how to handle those struchts.
>Basicaly I know that I can send a String that have the right lenght and somehow handle the single chars as bytes, but this is my limit of knowledge.
>
>It all goes on scanning of barcodes, it's from the evaluation version of the QS-Barcode SDK from www.qualitysoft.de .
>
>I use the VB example here.
>
>
>'QS-Barcode API
>'------------------------------------------------------------------------
>Declare Function QSReadBarcode2 Lib "QSBarDLL_F.dll" ( _
>    ByVal szImageName As String, _
>    pBarcode2 As WU_Barcode2, _
>    ByVal iNumResults As Long) As Long
>Declare Function QSGetNextBarResult2 Lib "QSBarDLL_F.dll" ( _
>    pBarcodeResult2 As WU_BarcodeResult2) As Long
>
>'
>'TwoDim_Result
>'
>Type WU_TwoDimResult
>    hBC_TwoDimRes As Long
>    iBC_TwoDimLen As Long
>    iBC_TwoDimRows As Long
>    iBC_TwoDimCols As Long
>    iBC_PdfECL As Long
>End Type
>'
>'  Type WU_Barcode2
>'
>Type WU_Barcode2
>    iBC_Type As Long
>    iBC_Type2 As Long
>    iBC_Length As Long
>    iBC_Checksum As Long
>    iBC_Orientation As Long
>    iBC_ReadMultiple As Long
>    iBC_LightMargin As Long
>    iBC_ScanDistance As Long
>    iBC_Percent As Long
>    iBC_ScanDistBarcode As Long
>    iBC_MaxHeight As Long
>    iBC_MinHeight As Long
>    iBC_MaxNoVal As Long
>    iBC_Tolerance As Long
>    iBC_StartX As Long
>    iBC_StartY As Long
>    iBC_SizeX As Long
>    iBC_SizeY As Long
>    iLaengeVon As Long
>    iLaengeBis As Long
>End Type
>'
>' Type WU_BarcodeResult2
>'
>Type WU_BarcodeResult2
>    iBC_Type As Long
>    iBC_Type2 As Long
>    iBC_Status As Long
>    szBC_Barcode As String * 64
>    iBC_StartX As Long
>    iBC_StartY As Long
>    iBC_SizeX As Long
>    iBC_SizeY As Long
>    iBC_Orientation As Long
>    pBC_TwoDimRes As WU_TwoDimResult
>End Type
>
>
>So my idea of QSReadBarcode2 Lib would be
>
>Declare LONG QSReadBarcode2      IN "QSBarDLL_F.dll" STRING szImageName,STRING @pBarcode2 ,LONG iNumResults
>szImageName = GETFILE()+CHR(0)
>pBarcode2   = replicate(CHR(0),10*4)  &&10 Elements of Long
>iNumResults = 0
>?QSReadBarcode2(szImageName,@pBarcode2 ,iNumResults)
>
>
>This at least returns an errorcode (the pBarcode2 is empty so I expect it)
>
>But now the question starts
>is LONG as simple to read as
>
> ASC(SUBSTR(cString,1,1)*16777216;
>+ASC(SUBSTR(cString,2,1)*65536;
>+ASC(SUBSTR(cString,2,1)*256;
>+ASC(SUBSTR(cString,2,1)*
>
>or do I mix up things or do they something with the high byte - low byte order?
>
>for the WU_BarcodeResult2 struct I have no idea how to deal with.
>
>Could somebody enlighten me how to deal with this?
>
>TIA
>
>Agnes


Agnes,

>But now the question starts
>is LONG as simple to read as
>
> ASC(SUBSTR(cString,1,1)*16777216;
>+ASC(SUBSTR(cString,2,1)*65536;
>+ASC(SUBSTR(cString,2,1)*256;
>+ASC(SUBSTR(cString,2,1)*
>
Yes, and even simpler

(1) if you want to put a long value in a string
s = bintoc(theValue, '4rs')
(2) If you want know the value
theValue = ctobin(substr(s, 1, 4), '4rs')
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform