-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMouse_changer.cpp
98 lines (89 loc) · 3.69 KB
/
Mouse_changer.cpp
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "pch.h"
//#include <iostream>
#include <Windows.h>
void Set_rus_cursor()
{
//подгружаем русские курсоры
HCURSOR rus_arrow = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgarro.cur");
HCURSOR rus_help = LoadCursorFromFile(L"c:\\Windows\\Cursors\\help_i_rus.cur");
HCURSOR rus_move = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dsmove.cur");
HCURSOR rus_no = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgno.cur");
HCURSOR rus_pen = LoadCursorFromFile(L"c:\\Windows\\Cursors\\text_rus_cursor.cur");
HCURSOR rus_diag_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgnesw.cur");
HCURSOR rus_vert_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgns.cur");
HCURSOR rus_diag_arrows2 = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgnwse.cur");
HCURSOR rus_horizont_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\3dgwe.cur");
HCURSOR rus_href = LoadCursorFromFile(L"c:\\Windows\\Cursors\\up_i_rus.cur");
HCURSOR rus_wait = LoadCursorFromFile(L"c:\\Windows\\Cursors\\dinosaur2.ani");
SetSystemCursor(rus_arrow, 32512);
SetSystemCursor(rus_help, 32650);
SetSystemCursor(rus_move, 32515);
SetSystemCursor(rus_href, 32649);
SetSystemCursor(rus_help, 32651);
SetSystemCursor(rus_pen, 32513);
SetSystemCursor(rus_no, 32648);
SetSystemCursor(rus_move, 32646);
SetSystemCursor(rus_diag_arrows, 32643);
SetSystemCursor(rus_vert_arrows, 32645);
SetSystemCursor(rus_diag_arrows2, 32642);
SetSystemCursor(rus_horizont_arrows, 32644);
SetSystemCursor(rus_href, 32516);
SetSystemCursor(rus_wait, 32514);
}
void Set_en_cursor()
{
//подгружаем английские курсоры
HCURSOR en_arrow = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_arrow.cur");
HCURSOR en_help = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_helpsel.cur");
HCURSOR en_move = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_move.cur");
HCURSOR en_no = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_unavail.cur");
HCURSOR en_pen = LoadCursorFromFile(L"c:\\Windows\\Cursors\\beam_r.cur");
HCURSOR en_diag_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_nesw.cur");
HCURSOR en_vert_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_ns.cur");
HCURSOR en_diag_arrows2 = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_nwse.cur");
HCURSOR en_horizont_arrows = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_ew.cur");
HCURSOR en_href = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_link.cur");
HCURSOR en_wait = LoadCursorFromFile(L"c:\\Windows\\Cursors\\aero_busy.ani");
SetSystemCursor(en_arrow, 32512);
SetSystemCursor(en_help, 32650);
SetSystemCursor(en_move, 32515);
SetSystemCursor(en_href, 32649);
SetSystemCursor(en_help, 32651);
SetSystemCursor(en_pen, 32513);
SetSystemCursor(en_no, 32648);
SetSystemCursor(en_move, 32646);
SetSystemCursor(en_diag_arrows, 32643);
SetSystemCursor(en_vert_arrows, 32645);
SetSystemCursor(en_diag_arrows2, 32642);
SetSystemCursor(en_horizont_arrows, 32644);
SetSystemCursor(en_href, 32516);
SetSystemCursor(en_wait, 32514);
}
int main(int argc, char **argv)
{
ShowWindow(GetConsoleWindow(), SW_HIDE);
while (true)
{
HWND window_handle = GetForegroundWindow();
DWORD thread = GetWindowThreadProcessId(window_handle, 0);
HKL locale = GetKeyboardLayout(thread);
Sleep(500); //milliseconds for waiting
HKL locale2 = GetKeyboardLayout(thread);
if (locale == locale2)
{
continue;
}
//std::cout << LOWORD(locale) << "\n";
if (LOWORD(locale2) == 1033)
{
// std::cout << "en" << "\n";
Set_en_cursor();
}
if (LOWORD(locale2) == 1049)
{
// std::cout << "ru" << "\n";
Set_rus_cursor();
}
//en 1033 ru 1049
}
}