28
Appendix B - Programming Options
The following example code demonstrates how to obtain Z data. For a complete
example, see the included source code for ZAXIS.EXE.
#include "mmioctl.h"
HANDLE hndFile;
LONG
ULONG
DWORD
LONG
BOOL
//
//
hndFile = CreateFile(
);
if (hndFile == INVALID_HANDLE_VALUE) {// Was the device opened?
return(0);
}
// See if controller supports Z before going any further
IOBuffer = 0;
IoctlCode = IOCTL_MM_ZAXIS_SUPPORT;
IoctlResult = 0;
DataLength = 4;
IoctlResult = DeviceIoControl(
);
if (!IoctlResult)
capabilities",
//
// Call the driver to get Z values
//
IOBuffer = 0;
IoctlResult = 0;
DataLength = sizeof(LONG);
IoctlCode;
DataLength;
ReturnedLength;
IOBuffer;
IoctlResult;
"\\\\.\\MMDev",
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
0,
NULL
MessageBox(NULL, "Unable to open touchscreen",
"Driver Loaded?", MB_OK);
hndFile,
IoctlCode,
NULL,
0,
&IOBuffer,
DataLength,
&ReturnedLength,
NULL
// No z
MessageBox(NULL, "This controller does not support Z reporting
"NO Z", MB_OK | MB_ICONEXCLAMATION);
// Win32 handle of "MMDev" device
// Function to perform
// Output buffer data length
// Actual number of bytes returned
// Input/output system buffer
// Result of operation
// Open Win32 touchscreen device(MMDev)
// Open the device "MMDev"
// Handle to device
// IO Control code for Read
// We don't need input data
// No input buffer required, NULL bytes
// Buffer from driver.
// Length of buffer in bytes.
// Bytes placed in DataBuffer.
// NULL means wait till op. completes.
Need help?
Do you have a question about the MonitorMouse FOR WINDOWS NT Version 2.0 and is the answer not in the manual?
Questions and answers