У нас немного по другому:
X++:
void init()
{
...
sc = new ComPortMSComm();
sc.initParmDefault();
...
}
void GetBarcode()
{
Barcode input;
ComVariant res;
str 1 ch;
int i, template;
;
i = sc.InBufferCount();
input = "";
if(i)
{
sleep(50);
i = sc.InBufferCount();
while(i > 0)
{
res = null;
ch = "";
res = sc.Input();
ch = res.bStr();
input = input + ch;
i = sc.InBufferCount();
}
}
element.setTimeOut("GetBarcode", 100);
}