Dzięki za odpowiedź :) tak chodziło o:
UINT GetData
{
LPBYTE buffer,
UINT * uiLength,
UINT * uiType
}
dodatkowo mam takie informacje:
Parameters
buffer
[out] buffer for string scanned data.
uiLength
[in/out] buffer size
uiType
[out] barcode type
Return Values
Return 1 if the operation is successful, otherwise return 0.
Remarks
If the buffer size is less than scan data, function return 0 and the parameter uiLength return the size of the buffer to get barcode data.
Na stringu nie działa:
string buffer = "empty";
uint uiLength = 0;
uint uiType = 0;
uint res = 3;
res = API_GetBarData(ref buffer, ref uiLength, ref uiType);
MessageBox.Show(res.ToString());
Czy zrobię z ref czy bez to cały czas w zmiennej jest "empty". Zmienna uiLength przyjmuje wartość 22 - czyli coś się dzieje, natomiast uiType pozostaje 0, a sama funkcja zwraca wartość 0 czyli błąd.
W C++ napisałem to tak i śmigało idealnie:
UINT uiSize, uiType, i, j;
char* pBuf;
CString fileData;
uiSize = j = 0;
getData = false;
uiSize = GetDataLength(); // pobranie ilosci zeskanowanych znakow
if(uiSize > 0) {
memset(pBuf, 0, 100);
memset(fileData, 0, 100);
GetData((LPBYTE)pBuf, &uiSize, &uiType); // pobranie danych z czytnika
for(i = 0; i < uiSize; i++) {
if(getData == TRUE) {
if(isdigit(pBuf[i])) {
fileData[j] = pBuf[i]; // usuwanie zbednych znakow
j++;
}
}
if(pBuf[i] == ')') {
getData = true;
}
}
}
Może Tobie uda się dostrzec coś co ja przeoczyłem z góry dzięki za pomoc.