Elo TouchSystems 1525L User Manual

Page 138

Advertising
background image

Section 5. Example Applications


135

DWORD

read_len=0;

char

wbuff[1];

char*

p;

while (!quit)

{
rs = ReadFile(drv_h, wbuff, sizeof(wbuff), &read_len, &ov_r);
if ( !rs)

{
rs = GetLastError ();
if ( rs != ERROR_IO_PENDING)

{
printf("DeviceIOControl (Read) Error : %i (0x%x)\n", rs, rs );
break;
}

}

rs = WaitForSingleObject ( ov_r.hEvent, INFINITE);
rs = GetOverlappedResult (

drv_h,

// handle of file, pipe, or communications device

&ov_r,

// address of overlapped structure

&read_len,

// address of actual bytes count

FALSE

// wait flag

);

if (quit)

break;

if ( rs )

{
p = wbuff;
while (read_len >0)

{
if (*p == 0x1a)

{

quit = TRUE;
printf("\n\nExiting Test...");
break;

}

putch (*p);
++p;
--read_len;
}

}

}

};

// end of file

Advertising