Aunching the, Ouchscreen, Ontrol – Elo TouchSystems MonitorMouse FOR WINDOWS NT Version 2.0 User Manual
Page 34: Anel, Alibrating from, Ithin, Rogram
Launching the Touchscreen Control Panel
29
IoctlResult = DeviceIoControl(
hndFile,
// Handle to device
IoctlCode,
// IO Control code
NULL,
// We don't need input data
0,
// No input buffer required, 0 bytes
&IOBuffer,
// Buffer from driver.
// This buffer will contain Z data
DataLength,
// Length of buffer in bytes.
&ReturnedLength,
// Bytes placed in DataBuffer.
NULL
// NULL means wait I/O completes.
);
if (!IoctlResult)
// We had a real mouse event.
;
// The DeviceIoControl call will
// return 0 if a mouse(not touch)
// event occurred.
L
AUNCHING THE
T
OUCHSCREEN
C
ONTROL
P
ANEL
It is possible to launch the Touchscreen Control Panel directly from a Windows
NT application using the following code:
handle = WinExec("control monmouse.cpl", SW_SHOWNORMAL);
C
ALIBRATING FROM
W
ITHIN
Y
OUR
P
ROGRAM
You may also call the calibration procedure of the Touchscreen Control Panel
directly from your program with the exported function Calibrate-Screen(). It takes
two arguments-your window handle and a timeout value in seconds (0 = no
timeout).
The following code fragment demonstrates how to call this function. For a
complete example, see the included source code, CALIB.C.
WORD Timeout;
HWND hWnd;
// window handle
FARPROC lpfnCalibrateScreen;
// pointer to Calibrate function
HANDLE hLibrary;
// MONMOUSE.CPL library handle
// Load the Control Panel applet
hLibrary = LoadLibrary("MONMOUSE.CPL");
if (hLibrary < (HANDLE)32) {
MessageBox(NULL, "Could not load Calibration Library.",
"NoLoad", MB_OK);
break;
}
// Get address of CalibrateScreen function
lpfnCalibrateScreen = GetProcAddress(hLibrary, MAKEINTRESOURCE(4));
// timeout in 5 minutes
Timeout = 300;
// Call CalibrateScreen function
(*lpfnCalibrateScreen)(hWnd, Timeout);
FreeLibrary(hLibrary);