Wie umwandeln für Qt?
Verfasst: 8. Juli 2008 15:02
Hallo!
Ich nutze eine C-Library, um einen Barcode-Scanner anzusprechen, aber irgendwie klappt es mit dem "Abholen" des Barcode-Inhaltes nicht hin.
Mit diesem Marco soll ich an den Inhalt kommen: (LPTSTR)SCNBUF_GETDATA(lpScanBuffer), wobei lpScanBuffer das u.g. Struct ist.
Aber in was muss ich es umwandeln, damit ich den Inhalt in Qt nutzen kann (QString,QByteArray,...)?
Ich habe irgendwie total das Brett vor dem Kopf...
Als Grundlage dient dieses Struct:
PS: Falls es in das C/C++ Forum gehört, bitte verschieben.
Ich nutze eine C-Library, um einen Barcode-Scanner anzusprechen, aber irgendwie klappt es mit dem "Abholen" des Barcode-Inhaltes nicht hin.
Mit diesem Marco soll ich an den Inhalt kommen: (LPTSTR)SCNBUF_GETDATA(lpScanBuffer), wobei lpScanBuffer das u.g. Struct ist.
Aber in was muss ich es umwandeln, damit ich den Inhalt in Qt nutzen kann (QString,QByteArray,...)?
Ich habe irgendwie total das Brett vor dem Kopf...
Code: Alles auswählen
(LPTSTR)SCNBUF_GETDATA(lpScanBuffer)
#define SCNBUF_GETDATA(ptr) \
(((LPBYTE)ptr)+SCNBUF_GETOFFSET(ptr))
#define SCNBUF_GETOFFSET(ptr) \
( SI_FIELD_VALID(ptr,dwOffsetDataBuff) ? (ptr)->dwOffsetDataBuff : sizeof(SCAN_BUFFER) )
Code: Alles auswählen
typedef struct tagSCAN_BUFFER_A
{
STRUCT_INFO StructInfo;
DWORD dwDataBuffSize; // Size of data buffer in bytes (includes aux buffer)
DWORD dwOffsetDataBuff; // Offset from start of struct to data buffer
DWORD dwDataLength; // Length of data placed into buffer
DWORD dwTimeout; // Read timeout in milliseconds
// Set by application via C API
DWORD dwStatus; // Status of the read request
// Set by PDD and by MDD
// E_SCN_SUCCESS if complete
// E_SCN_DEVICEFAILURE if disconnected
// E_SCN_READPENDING while pending
// or some other error if appropriate
BOOL bText; // Data is text
// Set by application via C API
LABELTYPE dwLabelType; // Symbol label type code
// Set by PDD after good read
DWORD dwRequestID; // Request ID assigned to the read
// Set by C API
SYSTEMTIME TimeStamp; // System time when read completed
// Set by MDD after good read
DWORD dwDirection; // Direction label was scanned
// Set by PDD after good read
CHAR szSource[MAX_SRC]; // SCNx:Symbology
// Set by MDD after good read
BOOL bIsMultiPart; // Set to true if data is in a multi-part format
// Set by PDD after good read
DWORD dwScanID; // Scan ID assigned to a read
// Multiple barcodes obtained from the same scan
// will have the same ID
// Set by MDD after good read
DWORD dwBarcodeID; // Barcode ID assigned to a physical barcode
// Multiple data packets from the same physical
// barcode will have the same ID
// Set by MDD after good read
DWORD dwNumRemaining; // The number of remaining barcodes or data packets
// obtained from the same scan
// Set by MDD after good read
DWORD dwOffsetAuxDataBuff;// Offset from start of struct to auxilliary data buffer
// Set by PDD after good read
DWORD dwAuxDataLength; // Length of data in auxilliary data buffer
// Set by PDD after good read
} SCAN_BUFFER_A;
PS: Falls es in das C/C++ Forum gehört, bitte verschieben.