-
Notifications
You must be signed in to change notification settings - Fork 0
/
CKMData.h
81 lines (63 loc) · 1.16 KB
/
CKMData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include "stdafx.h"
#include <intsafe.h>
class CKMData
{
public:
ULONG32 ulKeyStrokes{ 0 };
ULONG32 ulLeftClick{ 0 };
ULONG32 ulRightClick{ 0 };
ULONG32 ulMiddleClick{ 0 };
ULONG64 ullDistance{ 0 }; // as 1/10 mm
void Reset(void)
{
ulKeyStrokes = 0;
ulLeftClick = ulRightClick = ulMiddleClick = 0;
ullDistance = 0;
}
ULONG32 IncKeyStrokes(ULONG32 inc = 1)
{
ulKeyStrokes += inc;
return ulKeyStrokes;
}
ULONG32 IncLeftClick(ULONG32 inc = 1)
{
ulLeftClick += inc;
return ulLeftClick;
}
ULONG32 IncRightClick(ULONG32 inc = 1)
{
ulRightClick += inc;
return ulRightClick;
}
ULONG32 IncMiddleClick(ULONG32 inc = 1)
{
ulMiddleClick += inc;
return ulMiddleClick;
}
ULONG64 IncDistance(ULONG32 inc)
{
ullDistance += inc;
return ullDistance;
}
int PutToBuffer(unsigned char* pBuf, int pos)
{
if (pBuf && pos >= 0)
{
pBuf += pos;
::memcpy(pBuf, this, sizeof(CKMData));
pos += sizeof(CKMData);
}
return pos;
}
int GetFromBuffer(unsigned char* pBuf, int pos)
{
if (pBuf && pos >= 0)
{
pBuf += pos;
::memcpy(this, pBuf, sizeof(CKMData));
pos += sizeof(CKMData);
}
return pos;
}
};