-
5.3.2. Event for Optical Input Change
Function Description:
It is more effective if check input only when it changes status. When any input changes it status, a
named event, IOCOpticalInputEvent, is generated. Applications can use a thread to catch this event
for necessary tasks. An example thread as below,
…
void WINAPI IOInputthread()
{
HANDLE gOpticalIOInputEvent = NULL;
DWORD dwStatus;
HANDLE gIOControlDriverHandle;
…
gIOControlDriverHandle = CreateFile(L”IOC1:”, GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
If (gIOControlDriverHandle == INVALID_HANDLE_VALUE)
{
// IO device not found, function not supported,
// error process
}
…
gOpticalIOInputEvent = CreateEvent(NULL, FALSE, FALSE,
IOC_OPTICAL_INPUT_EVENT);
if (gOpticalIOInputEvent == NULL)
{
// not supported
// error process
}
while (1)
{
WaitForSingleObject(gOpticalIOInputEvent,
INFINITE);
IOC_GetOpticalInput(&dwStatus);
// process input change tasks
//…
}
}
In ioc_ioctl.h, IOC_OPTICAL_INPUT_EVENT is defined as
#define IOC_OPTICAL_INPUT_EVENT _T("IOCOpticalInputEvent")
Be aware to release handles when program ends.
Содержание MR650
Страница 1: ...MR650 Programming Manual V 1 12 1 16 2008 ...
Страница 7: ... 7 13 FUNCTION KEY SETTING ON REGISTRY 65 14 UPDATE NOTES 66 ...
Страница 16: ... it is for internal use send messages ...
Страница 33: ... Be aware to release handles when program ends ...