DMT-DDv2.16 API e
DMT-DDv2.16 API e
Table of Contents
1. System Requirements ................................................................................................................................... 3
1.1. System Configuration .............................................................................................................................................................. 3
1.2. Execute Prerequisites.............................................................................................................................................................. 3
2. How to Use API ............................................................................................................................................... 4
3. Common API....................................................................................................................................................... 5
3.1. Acquiring the number of connected devices. ........................................................................................................ 5
3.2. Acquiring Device Instance Path ...................................................................................................................................... 5
4. API for Calibration .......................................................................................................................................... 6
4.1. Performing 4-point calibration ............................................................................................................................................ 6
4.2. Performing 9-point calibration ............................................................................................................................................ 7
4.3. Deleting Calibration Data ..................................................................................................................................................... 8
5. Implementation Example of Calibration Execution ................................................................... 9
6. Enabling/Disabling Touch API ............................................................................................................... 10
6.1. Enabling and Disabling of Touch ................................................................................................................................. 10
6.2. Acquiring Enabling/Disabling Status of Touch ..................................................................................................... 10
7. Implementation Example of Enabling/Disabling Touch ........................................................ 11
8. Acquiring Status ............................................................................................................................................. 12
8.1. Acquiring Status Information ............................................................................................................................................ 12
9. Implementation Example of Status Acquisition ........................................................................ 13
10. Device Initialization ....................................................................................................................................... 14
10.1. Device Initialization ................................................................................................................................................................. 14
11. Implementation Example of Device Initialization ...................................................................... 15
12. Acquiring assignment information of registered monitor .................................................. 16
11.1. Acquiring assignment information of registered monitor ..................................................................................... 16
11.2. Registering assignment information of monitor ......................................................................................................... 16
13. Implementation Example of Assignment Information of Registered Monitor ........ 17
14. Touch Data Acquisition ............................................................................................................................. 18
14.1. Touch Detection (Registration or Cancel of Windows Even) ......................................................................... 18
14.2. Touch Data......................................................................................................................................................................................... 18
15. Implementation Example of Touch Data Acquisition ............................................................ 20
16. EEPROM Setting............................................................................................................................................. 25
15.1. Acquiring status of EEPROM ................................................................................................................................................ 25
15.2. Setting Status of EEPROM .................................................................................................................................................... 25
17. Implementation Example of EEPROM Calibration ................................................................... 26
18. Right-Click Setting ........................................................................................................................................ 27
18.1. Acquiring method of Right-Click .......................................................................................................................................... 27
18.2. Setting method of Right-click ................................................................................................................................................ 28
19. Implementation Example of Right-click setting ......................................................................... 29
20. Output Rate Setting ..................................................................................................................................... 30
20.1. Acquiring output rate ................................................................................................................................................................... 30
20.2. Setting Output rate ....................................................................................................................................................................... 30
21. Implementation Example of Output Rate Setting..................................................................... 31
1. System Requirements
1.1. System Configuration
(1) OS
Windows XP/7/8/8.1/10/11 32bit / 64bit Home or greater Editions
(3) Monitor
Multi-display supported.
The libraries are as follow. Select the appropriate file according to Windows versions.
OS Required .Net Framework Folder
Windows XP / 7 / 8 / 8.1 Microsoft .Net Framework 3.5 NET3.5
Windows 10 / 11 Microsoft .Net Framework 4.6 NET4.6
■How to Build
Copy or make the reference path of the files under /lib appropriate to the OS into build-source paths,
then execute build.
/NET3.5
|─lib
|─DriverSetting.h
|─DriverSetting.lib
|─DriverSetting_x64.lib
/NET4.6
|─lib
|─DriverSetting.h
|─DriverSetting.lib
|─DriverSetting_x64.lib
■How to Execute
Copy all the files under /bin appropriate to the OS into the folder in which the built execute files are
stored.
/NET3.5
|─bin
|─DriverSetting.dll
|─DriverSetting_x64.dll
/NET4.6
|─bin
|─DriverSetting.dll
|─DriverSetting_x64.dll
3. Common API
int GetTouchDeviceCount(void)
1 void - None
Return Value
Success :Number of devices being connected
Fail :0 *No connection of a device
Remark
None
Remark
At success, [no]th device instance path will be stored into DeviceInstancePath of parameter.
[MAX_PATH] is the maximum path size defined by Windows..
Specify the device instance path and perform 4-point calibration. If the device is not assigned with a
monitor, an error will be returned.
Return Value
Success :1
Cancel :0
Fail :-1
No assignment :-2
Not supported :-3
Remark
If the parameter is NULL, selection screen of device (monitor) on which calibration is to be performed
will appear.
After selecting a monitor by following the instruction on the screen, calibration screen will appear.
If timeout setting is registered (except when it is registered as None) in the registry, the calibration will
automatically end (cancelled) after certain duration of time passed without any operation after the time
ideal point (cross and circle) appeared.
Registry Path
HKLM¥SYSTEM¥CurrentControlSet¥services¥MultiFunctionDriver¥Parameters¥Devic
e
Specify the device instance path and perform 9-point calibration. If the device is not assigned with a
monitor, an error will be returned.
When EPROM is enabled, the calibration data will be written into the EERPOM.
Return Value
Success :1
Cancel :0
Fail :-1
No Assignment :-2
Not supported :-3
Remark
If the parameter is NULL, selection screen of device (monitor) on which calibration is to be performed
will appear.
After selecting a monitor by following the instruction on the screen, calibration screen will appear.
If timeout setting is registered (except when it is registered as None) in the registry, the calibration will
automatically end (cancelled) after certain duration of time passed without any operation after the time
ideal point (cross and circle) appeared.
Registry Path
HKLM¥SYSTEM¥CurrentControlSet¥services¥MultiFunctionDriver¥Parameters¥Devic
e
When EEPROM is enabled, the calibration data will be deleted from the EEPROM.
Return Value
Success :1
Fail :-1
Not supported :-3
Remark
In the case of NULL, calibration data of all the devices will be deleted.
#include <stdio.h>
#include <windows.h>
void main(void)
{
USHORT num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
switch(Result)
{
// Calibration is completed
case 1:
printf("calibration is Complete¥n");
break;
case 0: // Cancel
case -1: // Fail
case -2: // No assingment with a monitor
printf("calibration is not Complete¥n");
break;
}
}
return;
}
Return Value
Success :1
Fail :-1
Remark
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
Return Value
Enable :1
Disable :0
Fail :-1
Remark
If DeviceInstancePath is NULL, Fail (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
// Disbaing touch.
int Result = SetTouchEnable(device, false);
if (Result == true)
{
// Sccess
printf("Disable Touch is Complete¥n");
}
else
{
// Fail
printf("Disable Touch is Failed¥n");
}
}
}
8. Acquiring Status
Return Value
In operation :1
No connection :0
Fail :-1
Driver is abnormal :-2
Communication fails :-3
Port open fails :-4
Controller is abnormal :-5
Remark
If DeviceInstancePath is NULL, fail(-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}
// Acuqring status
int Result = GetTouchDeviceState(device);
switch(Result)
{
// In operation
case 1:
printf("get device state is OK¥n");
break;
case 0: // No connection
case -1: // Fail
case -2: // Driver is abnormal
case -3: // Communication fails
case -4: // Port open fails
case -5: // Controller is abnormal
printf("get device state is Failed¥n");
break;
}
}
}
Return Value
Initialization is completed :1
Time-out :0
Fail :-1
Communication fails :-3
Port open fails :-4
Controller is abnormal :-5
Not supported :2
Reamarks
If DeviceInstancePath is NULL, fail (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}
// Initializing device
int Result = ResetTouchDevice(device);
switch(Result)
{
// Initialization is completed
case 1:
printf("device reset is Complete¥n");
break;
case 0: // Timeout
case -1: // Fail
case -3: // Communication fails
case -4: // Port open fails
case -5: // Controller is abnormal
case 2: // Not supported
printf("device reset is Failed¥n");
break;
}
}
}
Return Value
Success :Size of MonitorSymbol
Fail :0
Remark
If DeviceInstancePath is NULL, fail(0) will be returned.
Return Value
Success :1
Fail :0
Remark
If DeviceInstancePath is NULL, fail (0) will be returned.
If MonitorSymbol is NULL or NIL, assignment information will be deleted.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}
if (symbolSize != 0)
{
// Success
printf("get attached monitor symbol is Complete¥n");
}
else
{
// Fail
printf("get attached monitor symbol is Failed¥n");
}
Return Value
Success :1
Fail :-1
Remark
If DeviceInstancePath is NULL, registration or cancel is made to all the touch devices.
After registration, normal touch and mouse output will not be made until cancellation.
The data informed with WM_INPUT message will be acquired by RawInput API of Windows.
・Structure of [RAWINPUTHEADER]
[ReportID] of the head [0] byte is used to identify the acquired data.
#include "stdafx.h"
#include <windows.h>
#include <string>
#include <Cfgmgr32.h>
#include <setupapi.h>
#pragma comment(lib, "setupapi.lib")
#pragma pack(push,1)
struct Touch {
UCHAR Status;
USHORT X;
USHORT Y;
USHORT Width;
USHORT Height;
USHORT Pressuer;
USHORT Azimuth;
USHORT ScanTime;
UCHAR ContactCount;
};
struct Mouse {
UCHAR Status;
UCHAR Dummy1;
UCHAR Dummy2;
unsigned long X;
unsigned long Y;
};
if ('#' == instance[i]) {
instance[i] = '¥¥';
} else if ('{' == instance[i]) {
instance[i -1] = '¥0';
break;
} else if ('¥0' == instance[i]) {
break;
}
}
return (int)strlen(instance);
}
UINT cbSize;
if(raw->header.dwType != RIM_TYPEHID)
return FALSE;
if(raw->data.hid.dwSizeHid != sizeof(RawData))
return FALSE;
cbSize = MAX_PATH;
switch(RawData.ReportID) {
// Touch data
case 10: {
Touch* pTouch = (Touch*)&RawData.touch;
int id = Get_Hid_Degitizer_TouchID(pTouch->Status);
int State = Get_Hid_Degitizer_TouchState(pTouch->Status);
int x = pTouch->X;
int y = pTouch->Y;
}break;
// Mouse data
case 11: {
Mouse* pMouse = (Mouse*)&RawData.mouse;
int State = pMouse->Status;
long x = pMouse->X;
long y = pMouse->Y;
}break;
}
}
return 0;
}
Return Value
EEPROM enabled :1
EEPROM disabled :0
Fail :-1
EEPROM absent :-2
EEPROM abnormal :-3
Remark
If DeviceInstancePath is NULL, fail (-1) will be returned.
Setting the usage status of EEPROM of controller of specified device instance path
Return Value
EEPROM enabled :1
EEPROM disabled :0
Fail :-1
EEPROM absent :-2
EEPROM abnormal :-3
Remark
If DeviceInstancePath is NULL, fail (-1) will be returned.
#include <stdio.h>
#include <windows.h>
#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit
#include "DriverSetting.h"
void main(void)
{
// Specifing the device and executing calibration
int num = GetTouchDeviceCount();
if( 1 != iState) {
/EEPROM calibration cannot ne executed if status of EEPROM is other than
enabled.
printf("Device=%d GetEEPROM is ERROR iStatus=%d ¥n", i, iState);
continue;
}
if( 1 == iState) {
// Success
printf("Device=%d ExecuteCalibration is Complete ¥n", i);
}else {
// Fail
printf("Device=%d ExecuteCalibration is ERROR iStatus=%d ¥n", i, iState);
}
}
return;
}
0: unset
2 Int* PressAndHoldTime
100 to 1000: detection time(ms)
0: unset
3 Int* PressAndHoldRange
100 to 1000: detection area
Return Value
Right-Click (Long touch) enabled :1
Right-Click (2-point touch) enabled :2
Right-Click disabled :0
Fail :-1
Remark
The current setting will be stored into PressAndHoldTime/PressAndHoldRange.
PressAndHoldTime and PressAndHoldRange are available only if Right-Click (Long touch) is enabled.
If DeviceInstancePath is NULL, fail (-1) will be returned.
0: disable
2 Bool state 1: Right-click (long touch) enable
2: Right-click (2-point touch) enable
Return Value
Success :1
Fail :-1
Remark
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
PressAndHoldTime and PressAndHoldRange are available only if Right-Click (Long touch) is enabled.
Right-click setting is available only if mouse input is enabled.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
// Switching Enable/Disable
int iFlg = 1; // Right-click (Long touch) enabled.
if( iState > 0) {
iFlg = 0; // Right-click disabled.
}
Return Value
Success :1 or greater
Not supported :0
Fail :-1
Remark
If the controller is not supported, “not supported” (0) will be returned.
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
Return Value
Success :1
Not supported :0
Fail :-1
Remark
If the controller is not supported, “not supported” (0) will be returned.
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
Return Value
Success :1
Fail :-1
Remark
If the controller is not supported, “fail” (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
// Fail
if (0 >= iState)
{
printf("Device=%d DirectCommand ERROR State=%d ¥n", i, iState);
}
}
}
Return Value
Success :1
Fail :-1
Remark
If the connected controller is not supported, “fail”(-1) will be returned.
If communication with controller is not started, “fail” (-1) will be returned.
int DirectRequest (char *DeviceInstancePath, unsigned char *Data, int Size, int TimeOut)
Return Value
Success :Receive Size
TimeOut :0
Fail :-1
Remark
If the connected controller is not supported, “fail”(-1) will be returned.
If communication with controller is not started, “fail” (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num)
{
// Device does not exist.
return;
}
Return Value
Enable :1
Disable :0
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
Return Value
Enable :1
Disable :0
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
Return Value
Success :1
Fail :-1
Return Value
Enable :1
Disable :0
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
Return Value
Success :1
Fail :-1
Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
Return Value
Success :1
Fail :-1
Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
Return Value
Success: 1
Fail: -1
Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
// Enabling X inversion
if (true== SetInvertedX(device, true)){
if (true== GetInvertedX(device)) {
printf("X Line is Inverted ¥n");
}
}
// Enablig Y inversoin
if (true== SetInvertedY(device, true)) {
if (true== GetInvertedY(device)) {
printf("Y Line is Inverted ¥n");
}
}
// Enabling XY swap
if (true== SetSwapXY(device, true)) {
if (true== GetSwapXY(device)) {
printf("XY Line is Swaped ¥n");
}
}
}
}
Return Value
4-point calibration : 1 *If EEPROM is enabled, calibration information will be acquired from EEPROM.
9-point calibration : 2 *If EEPROM is enabled, calibration information will be acquired from EEPROM.
Calibration inactive: 0 *If calibration is not performed, calibration inactive will be returned,
Fail :-1
Not supported : -2 *If the controller does not support EERPOM, Not supported will be returned.
Parameter
typedef struct CORRECTION{
USHORT p00x; /** @brief p00 X coordinate (4 points /9 points) 0〜32767*/
USHORT p00y; /** @brief p00 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p10x; /** @brief p10 X coordinate (4 points /9 points) 0〜32767*/
USHORT p10y; /** @brief p10 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p01x; /** @brief p01 X coordinate (4 points /9 points) 0〜32767*/
USHORT p01y; /** @brief p01 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p11x; /** @brief p11 X coordinate (4 points /9 points) 0〜32767*/
USHORT p11y; /** @brief p11 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p20x; /** @brief p20 X coordinate (9 points) 0〜32767*/
USHORT p20y; /** @brief p20 Y coordinate (9 points) 0〜32767*/
USHORT p21x; /** @brief p21 X coordinate (9 points) 0〜32767*/
USHORT p21y; /** @brief p21 Y coordinate (9 points) 0〜32767*/
USHORT p02x; /** @brief p02 X coordinate (9 points) 0〜32767*/
USHORT p02y; /** @brief p02 Y coordinate (9 points) 0〜32767*/
USHORT p12x; /** @brief p12 X coordinate (9 points) 0〜32767*/
USHORT p12y; /** @brief p12 Y coordinate (9 points) 0〜32767*/
USHORT p22x; /** @brief p22 X coordinate (9 points) 0〜32767*/
USHORT p22y; /** @brief p22 Y coordinate (9 points) 0〜32767*/
}Correction;
Reamrks
In 4-point caliration, 4 points P00 – P11 indicated as follows will be the effective coordinates for both
corrected and ideal points.
P00(X,Y) P10(X,Y)
P01(X,Y) P11(X,Y)
In 9-point caliration, 9 points P00 – P22 indicated as follows will be the effective coordinates for both
corrected and ideal points.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
// Enabling X inversion
switch(GetCalibrationInfomation (device, &correction, &ideal))
{
case 0: // Calibration inactive (Calibration is not performed)
printf("calibration is Complete¥n");
break;
Changing COM port number used by controller of specified device instance path.
Return Value
Success :1
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
If a non-existent COM port number is specified, “fail” (-1) will be returned.
Return Value
Open :1
Close :0
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}
Return Value
Success :1
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
For the configuration file name, specify one of the configuration file names that can be selected on the
DMT-DD setting tool.
Return Value
Success : :Size of ConfigFileName
Fail :-1
Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
#include <stdio.h>
#include <windows.h>
void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}