Elo TouchSystems 1525L User Manual

Page 136

Advertising
background image

Section 5. Example Applications


133

NULL,

// address of thread security attributes

0L,

// initial thread stack size, in bytes

(LPTHREAD_START_ROUTINE)input_thread,// addr of thread function
NULL,

// argument for new thread

0L,

// creation flags 0-run immediately

&retdw

// address of returned thread identifier

),

"Can't Create input thread" );

in_threadh = ret_h;
Sleep(100);
printf("\nTest Console started. (press <^Z> to terminate).\n");
} while (0);

switch ( stage)

{
case 9:

WaitForSingleObject (in_threadh, INFINITE); printf ("\n");

case 8:

quit = TRUE;
ws = WaitForSingleObject ( out_threadh, 300);
if (ws != WAIT_OBJECT_0)
{

DWORD ret_len;

}
SetEvent (ov_r.hEvent); //@@out_ev);
ws = WaitForSingleObject ( out_threadh, INFINITE);
CloseHandle ( out_threadh );
CloseHandle ( in_threadh );

case 7: CloseHandle ( ov_w.hEvent );
case 6: CloseHandle ( ov_r.hEvent );
case 1: CloseHandle ( drv_h );
}

return (0);
}

/* --- Helpers -------------------------------------------------------------- */

#define SINGLE_CHARS

void

input_thread

(void *p)

{
int

ch;

DWORD ws;
char

str[100];

ch = 0;
while(!quit)

{
#ifdef SINGLE_CHARS
ch = getch();
printf("%c", ch);
if (ch == 13)

printf("\n");

if ( ch == 0 )

{

if (kbhit())
{

ch = 0x100 + getch();

}

Advertising