• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

マウスカーソルへIMEモードの表示


Commit MetaInfo

Révision26bbcab399b63f3129c38ae3752f559fa1326b93 (tree)
l'heure2023-07-05 13:20:41
AuteurJeffyTS <jeffyts@outl...>
CommiterJeffyTS

Message de Log

1.1.1.7

Change Summary

Modification

--- a/FlushMouse/CommonDef.h
+++ b/FlushMouse/CommonDef.h
@@ -1,9 +1,10 @@
1-// CommonDef.h
1+//
2+// CommonDef.h
23 // Copyright (C) 1993 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0001 2023/04/27 JeffyTS New edit
7+// #0000 2023/04/27 JeffyTS New edit
78 //
89
910 //
@@ -17,8 +18,18 @@
1718 //
1819 #define MAX_LOADSTRING 100
1920
21+// Files
22+#define FULL_FLUSHMOUSE_EXE L"%ProgramFiles%\\JeffyTS\\FlushMouse\\FlushMouse.exe"
23+#define FULL_FLUSHMOUSE32_EXE L"%ProgramFiles%\\JeffyTS\\FlushMouse\\FlushMouse32.exe"
24+#define FULL_FLUSHMOUSE_DLL L"%ProgramFiles%\\JeffyTS\\FlushMouse\\FlushMouseDLL.dll"
25+#define FULL_FLUSHMOUSE32_DLL L"%ProgramFiles%\\JeffyTS\\FlushMouse\\FlushMouseDLL32.dll"
26+#define FLUSHMOUSE_EXE L"FlushMouse.exe"
27+#define FLUSHMOUSE32_EXE L"FlushMouse32.exe"
28+#define FLUSHMOUSE_DLL L"FlushMouseDLL.dll"
29+#define FLUSHMOUSE32_DLL L"FlushMouseDLL32.dll"
30+
2031 // Window Class
21-#define CLASS_FLUSHMOUSE L"FlushMouse-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}"
32+#define CLASS_FLUSHMOUSE L"FlushMouse-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}"
2233 #define CLASS_FLUSHMOUSE32 L"FlushMouse32-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}"
2334
2435 // for IME
--- a/FlushMouse/Cursor.cpp
+++ b/FlushMouse/Cursor.cpp
@@ -1,9 +1,10 @@
1-// Cursor.cpp
1+//
2+// Cursor.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/03 JeffyTS New edit.
7+// #0000 2022/03/03 JeffyTS New edit.
78 //
89
910 // Include
@@ -12,16 +13,20 @@
1213 #include "pch.h"
1314 #include "Profile.h"
1415 #include "Cursor.h"
15-#include "CommonDef.h"
1616 #include "FlushMouseLIB.h"
17+#include "CommonDef.h"
1718 #include "..\FlushMouseDLL\EventlogDll.h"
1819 #include "..\MiscLIB\CRegistry.h"
1920
2021 //
22+// Library
23+//
24+
25+//
2126 // Define
2227 //
23-#define FLUSHMOUSECURSORDIR _T("\\JeffyTS\\FlushMouse\\")
24-#define FLUSHMOUSECURSORDAT _T("FlushMouseCursor.dat")
28+#define FLUSHMOUSECURSORDIR _T("\\JeffyTS\\FlushMouse\\")
29+#define FLUSHMOUSECURSORDAT _T("FlushMouseCursor.dat")
2530
2631 // IME Cursor Change Thread
2732 #define IMECURSORCHANGETHREADID 1
@@ -45,412 +50,12 @@
4550 //
4651
4752 //
48-// Class CIME
49-//
50-CIME::CIME()
51-{
52- lpstVirtualDesktop = new VIRTUALDESKTOP[sizeof(VIRTUALDESKTOP)];
53- ZeroMemory(lpstVirtualDesktop, sizeof(VIRTUALDESKTOP));
54- bGetVirtualDesktopSize();
55-}
56-CIME::~CIME()
57-{
58- if (lpstVirtualDesktop != NULL) delete[] lpstVirtualDesktop;
59- lpstVirtualDesktop = NULL;
60-}
61-
62-//
63-// bIsIMEOpen()
64-//
65-BOOL CIME::bIsIMEOpen(HWND hWndObserved)
66-{
67- HWND hIMWnd = NULL;
68- if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
69- if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETOPENSTATUS, (LPARAM)NULL) != 0) {
70- return TRUE; // IME Open
71- }
72- }
73- return FALSE; // IME Close
74-}
75-
76-//
77-// vIMEOpenCloseForced()
78-//
79-VOID CIME::vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose)
80-{
81- if (hWndObserved == NULL) return;
82- LPARAM lParam = (LPARAM)dwIMEOpenClose;
83- EnumChildWindows(hWndObserved, &bEnumChildProcIMEOpenClose, lParam);
84- return;
85-}
86-
87-//
88-// vIMEConvertModeChangeForced()
89-//
90-VOID CIME::vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode)
91-{
92- if (hWndObserved == NULL) return;
93- LPARAM lParam = (LPARAM)dwConvertMode;
94- EnumChildWindows(hWndObserved, &bEnumChildProcIMEConvertMode, lParam);
95- return;
96-}
97-
98-//
99-// bEnumChildProcIMEConvertMode()
100-//
101-BOOL CALLBACK CIME::bEnumChildProcIMEConvertMode(HWND hWndObserved, LPARAM lParam)
102-{
103- if (hWndObserved == NULL) return FALSE;
104- HWND hIMWnd = NULL;
105- if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
106- if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETOPENSTATUS, (LPARAM)TRUE) == 0) {
107- if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETCONVERSIONMODE, (LPARAM)lParam) == 0) {
108- }
109- }
110- }
111- return TRUE;
112-}
113-
114-//
115-// bEnumChildProcIMEOpenClose()
116-//
117-BOOL CALLBACK CIME::bEnumChildProcIMEOpenClose(HWND hWndObserved, LPARAM lParam)
118-{
119- if (hWndObserved == NULL) return FALSE;
120- HWND hIMWnd = NULL;
121- if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
122- if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETOPENSTATUS, lParam) == 0) {
123- }
124- }
125- return TRUE;
126-}
127-
128-//
129-// dwIMEMode()
130-//
131-DWORD CIME::dwIMEMode(HWND hWndObserved, BOOL bForceHiragana)
132-{
133- if (hWndObserved != NULL) {
134- HWND hIMWnd = NULL;
135- HKL hkl = NULL;
136- DWORD dwInputLocale = 0;
137- DWORD dwConvertMode = 0;
138- if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
139- if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETOPENSTATUS, NULL) != 0) {
140- if ((dwConvertMode = (DWORD)SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETCONVERSIONMODE, NULL)) != 0) {
141- switch (dwConvertMode) {
142- case IME_CMODE_NATIVE:
143- dwConvertMode = IMEOFF;
144- break;
145- case ZENHIRA_IMEON:
146- case (ZENHIRA_IMEON ^ IME_CMODE_ROMAN):
147- dwConvertMode = ZENHIRA_IMEON;
148- break;
149- case HANEISU_IMEON:
150- case (HANEISU_IMEON ^ IME_CMODE_ROMAN):
151- dwConvertMode = HANEISU_IMEON;
152- break;
153- case HANKANA_IMEON:
154- case (HANKANA_IMEON ^ IME_CMODE_ROMAN):
155- dwConvertMode = HANKANA_IMEON;
156- break;
157- case ZENEISU_IMEON:
158- case (ZENEISU_IMEON ^ IME_CMODE_ROMAN):
159- dwConvertMode = ZENEISU_IMEON;
160- break;
161- case ZENKANA_IMEON:
162- case (ZENKANA_IMEON ^ IME_CMODE_ROMAN):
163- dwConvertMode = ZENKANA_IMEON;
164- break;
165- default:
166- dwConvertMode = IMEOFF;
167- }
168- if ((bForceHiragana != FALSE) && (dwConvertMode != ZENHIRA_IMEON)) {
169- vIMEConvertModeChangeForced(hWndObserved, ZENHIRA_IMEON);
170- dwConvertMode = ZENHIRA_IMEON;
171- return ZENHIRA_IMEON;
172- }
173- if ((hkl = Cime->hklGetInputLocale(hWndObserved)) != (HKL)0) {
174- if ((dwInputLocale = Cime->dwGetInputLocale()) != 0) {
175- if ((hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK))) != JP_IME) { // Not JP IME KB
176- dwConvertMode = IMEOFF; // IMEOFFとする
177- }
178- }
179- }
180- return dwConvertMode;
181- }
182- }
183- }
184- }
185- return IMEOFF;
186-}
187-
188-//
189-// vActivateIME()
190-//
191-VOID CIME::vActivateIME(HWND hWndObserved)
192-{
193- EnumChildWindows(hWndObserved, &bEnumChildProcActivateIME, NULL);
194-}
195-
196-//
197-// bEnumChildProcActivateIME()
198-//
199-BOOL CALLBACK CIME::bEnumChildProcActivateIME(HWND hWnd, LPARAM lParam)
200-{
201- UNREFERENCED_PARAMETER(lParam);
202-
203- HWND hIMWnd = ImmGetDefaultIMEWnd(hWnd);
204- if (hIMWnd != NULL) {
205- SendMessage(hIMWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
206- LPTSTR lpszBuffer = new TCHAR[_MAX_PATH];
207- ZeroMemory(lpszBuffer, (sizeof(TCHAR) * _MAX_PATH));
208- if (GetClassName(hIMWnd, lpszBuffer, _MAX_PATH) != 0) {
209- HWND hIMEWnd = FindWindow(lpszBuffer, NULL);
210- if (hIMEWnd != NULL) {
211- SendMessage(hIMEWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
212- if (lpszBuffer != NULL) delete[] lpszBuffer;
213- return TRUE;
214- }
215- }
216- if (lpszBuffer != NULL) delete[] lpszBuffer;
217- }
218- return TRUE;
219-}
220-
221-//
222-// bMoveIMEToolbar()
223-//
224-BOOL CIME::bMoveIMEToolbar()
225-{
226- if (bExistIMEToolbar()) {
227- while ((GetAsyncKeyState(VK_MENU) & 0x8000) || (GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
228- Sleep(50);
229- }
230- HWND hIMEWnd = FindWindow(_T("ApplicationFrameWindow"), NULL);
231- if (hIMEWnd != NULL) {
232- POINT ptCursor{};
233- if (GetCursorPos(&ptCursor)) {
234- RECT rc{};
235- if (GetWindowRect(hIMEWnd, &rc)) {
236- HMONITOR hMonitor = NULL;
237- if ((hMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTONEAREST)) != NULL) {
238- UINT dpiCursorX = 0, dpiCursorY = 0;
239- if ((GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiCursorX, &dpiCursorY)) == S_OK) {
240- if ((hMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTONEAREST)) != NULL) {
241- UINT dpiToolbarX = 0, dpiToolbarY = 0;
242- if ((GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiToolbarX, &dpiToolbarY)) == S_OK) {
243- // Drawも直す必要あり
244- LONG CursorMarginX = 0, CursorMarginY = 0;
245- if ((rc.right - rc.left) > (rc.bottom - rc.top)) {
246- CursorMarginX = 10 * ((dpiCursorX + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
247- CursorMarginY = 16 * ((dpiCursorY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
248- }
249- else {
250- CursorMarginX = 16 * ((dpiCursorX + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
251- CursorMarginY = 10 * ((dpiCursorY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
252- }
253- Sleep(10);
254- double rcLeft = 0, rcTop = 0;
255- if ((rc.right - rc.left) > (rc.bottom - rc.top)) {
256- rcLeft = (LONG)((double)rc.left + (6.0 * ((double)dpiToolbarX + (double)USER_DEFAULT_SCREEN_DPI - 1.0) / (double)USER_DEFAULT_SCREEN_DPI));
257- rcTop = (LONG)((double)rc.top + (9.0 * ((double)dpiToolbarX + (double)USER_DEFAULT_SCREEN_DPI - 1.0) / (double)USER_DEFAULT_SCREEN_DPI));
258- }
259- else {
260- rcLeft = (LONG)((double)rc.left + (9.0 * ((double)dpiToolbarX + (double)USER_DEFAULT_SCREEN_DPI - 1.0) / (double)USER_DEFAULT_SCREEN_DPI));
261- rcTop = (LONG)((double)rc.top + (6.0 * ((double)dpiToolbarX + (double)USER_DEFAULT_SCREEN_DPI - 1.0) / (double)USER_DEFAULT_SCREEN_DPI));
262- }
263- double px0 = lpstVirtualDesktop->rcMonitorSize.left;
264- double py0 = lpstVirtualDesktop->rcMonitorSize.top;
265- double cx = lpstVirtualDesktop->rcMonitorSize.right - lpstVirtualDesktop->rcMonitorSize.left;
266- double cy = lpstVirtualDesktop->rcMonitorSize.bottom - lpstVirtualDesktop->rcMonitorSize.top;
267- LONG xCursor = (LONG)(((((double)ptCursor.x - px0) * 65536.0) + cx - 1.0) / cx);
268- LONG yCursor = (LONG)(((((double)ptCursor.y - py0) * 65536.0) + cy - 1.0) / cy);
269- LONG xToolbar = (LONG)(((((double)rcLeft - px0) * 65536.0) + cx - 1.0) / cx);
270- LONG yToolbar = (LONG)(((((double)rcTop - py0) * 65536.0) + cy - 1.0) / cy);
271- LPINPUT lpInputs = NULL;
272- if ((lpInputs = new INPUT[sizeof(INPUT) * 4]) != NULL) {
273- ZeroMemory(lpInputs, sizeof(INPUT) * 4);
274- UINT cInputs = (UINT)(0);
275- // #0
276- lpInputs[cInputs].type = INPUT_MOUSE; lpInputs[cInputs].mi.dx = (DWORD)xToolbar; lpInputs[cInputs].mi.dy = (DWORD)yToolbar;
277- lpInputs[cInputs].mi.mouseData = 0; lpInputs[cInputs].mi.time = 0; lpInputs[cInputs].mi.dwExtraInfo = 0;
278- lpInputs[cInputs].mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
279- ++cInputs;
280- // #1
281- lpInputs[cInputs].type = INPUT_MOUSE; lpInputs[cInputs].mi.dx = (DWORD)xToolbar; lpInputs[cInputs].mi.dy = (DWORD)yToolbar;
282- lpInputs[cInputs].mi.mouseData = 0; lpInputs[cInputs].mi.time = 0; lpInputs[cInputs].mi.dwExtraInfo = 0;
283- lpInputs[cInputs].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
284- ++cInputs;
285- // #2
286- lpInputs[cInputs].type = INPUT_MOUSE; lpInputs[cInputs].mi.dx = (DWORD)xCursor; lpInputs[cInputs].mi.dy = (DWORD)yCursor;
287- lpInputs[cInputs].mi.mouseData = 0; lpInputs[cInputs].mi.time = 0; lpInputs[cInputs].mi.dwExtraInfo = 0;
288- lpInputs[cInputs].mi.dwFlags = MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK;
289- ++cInputs;
290- // #3
291- lpInputs[cInputs].type = INPUT_MOUSE; lpInputs[cInputs].mi.dx = (DWORD)xCursor; lpInputs[cInputs].mi.dy = (DWORD)yCursor;
292- lpInputs[cInputs].mi.mouseData = 0; lpInputs[cInputs].mi.time = 0; lpInputs[cInputs].mi.dwExtraInfo = 0;
293- lpInputs[cInputs].mi.dwFlags = MOUSEEVENTF_LEFTUP;
294- ++cInputs;
295- if (SendInput(cInputs, lpInputs, sizeof(INPUT)) == cInputs) {
296- Sleep(10);
297- }
298- delete[] lpInputs;
299- }
300- }
301- }
302- }
303- }
304- }
305- else {
306- return FALSE;
307- }
308- }
309- else {
310- return FALSE;
311- }
312- }
313- else {
314- return FALSE;
315- }
316- }
317- return TRUE;
318-}
319-
320-//
321-// bGetVirtualDesktopSize()
322-//
323-BOOL CIME::bGetVirtualDesktopSize()
324-{
325- BOOL bRet = FALSE;
326- if (lpstVirtualDesktop != NULL) {
327- ZeroMemory(lpstVirtualDesktop, sizeof(VIRTUALDESKTOP));
328- if (EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)&bGetVirtualDesktopSizeEnumProc, (LPARAM)lpstVirtualDesktop) != 0) {
329- bRet = TRUE;
330- }
331- else {
332- _Post_equals_last_error_ DWORD err = GetLastError();
333- if ((err == ERROR_INVALID_PARAMETER) || (err == ERROR_SUCCESS)) {
334- bRet = TRUE;
335- }
336- else if (err == ERROR_ACCESS_DENIED) {
337- bRet = TRUE;
338- }
339- else {
340- }
341- }
342- }
343- return bRet;
344-}
345-
346-//
347-// bGetVirtualDesktopSizeEnumProc()
348-//
349-BOOL CIME::bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam)
350-{
351- UNREFERENCED_PARAMETER(hDC);
352- UNREFERENCED_PARAMETER(lprcClip);
353- LPVIRTUALDESKTOP lpstVirtualDesktop = (LPVIRTUALDESKTOP)lParam;
354- MONITORINFO stMonInfo{}; stMonInfo.cbSize = sizeof(MONITORINFO);
355- if (GetMonitorInfo(hMonitor, &stMonInfo) != 0) {
356- if (stMonInfo.rcMonitor.left <= lpstVirtualDesktop->rcMonitorSize.left) lpstVirtualDesktop->rcMonitorSize.left = stMonInfo.rcMonitor.left;
357- if (stMonInfo.rcMonitor.right >= lpstVirtualDesktop->rcMonitorSize.right) lpstVirtualDesktop->rcMonitorSize.right = stMonInfo.rcMonitor.right;
358- if (stMonInfo.rcMonitor.top <= lpstVirtualDesktop->rcMonitorSize.top) lpstVirtualDesktop->rcMonitorSize.top = stMonInfo.rcMonitor.top;
359- if (stMonInfo.rcMonitor.bottom >= lpstVirtualDesktop->rcMonitorSize.bottom) lpstVirtualDesktop->rcMonitorSize.bottom = stMonInfo.rcMonitor.bottom;
360- ++lpstVirtualDesktop->iNumOfMonitors;
361- return TRUE;
362- }
363- return FALSE;
364-}
365-
366-//
367-// bExistIMEToolbar()
368-//
369-BOOL CIME::bExistIMEToolbar()
370-{
371-#define SUBKEY _T("Software\\AppDataLow\\software\\Microsoft\\ime\\15.0\\IMEJP\\MSIME")
372-#define VALUE _T("ToolBarEnabled")
373- CRegistry* CReg = new CRegistry;
374- DWORD dwToolBar = 0;
375- if (!CReg->bReadRegValueDWORD(HKEY_CURRENT_USER, SUBKEY, VALUE, &dwToolBar)) {
376- }
377- delete CReg;
378- if ((bIsNewIME() == TRUE) && (dwToolBar != 0)) return TRUE;
379- else return FALSE;
380-#undef SUBKEY
381-#undef VALUE
382-}
383-
384-//
385-// bIsNewIME()
386-//
387-BOOL CIME::bIsNewIME()
388-{
389-#define SUBKEY _T("Software\\Microsoft\\input\\tsf\\tsf3override\\{03b5835f-f03c-411b-9ce2-aa23e1171e36}")
390-#define VALUE _T("NoTsf3Override2")
391- CRegistry* CReg = new CRegistry;
392- DWORD dwCTF = 0;
393- if (!CReg->bReadRegValueDWORD(HKEY_CURRENT_USER, SUBKEY, VALUE, &dwCTF)) {
394- // ERROR_FILE_NOT_FOUND
395- dwCTF = 0;
396- }
397- delete CReg;
398- if (dwCTF != 0) return FALSE;
399- else return TRUE;
400-#undef SUBKEY
401-#undef VALUE
402-}
403-
404-//
405-// dGetInputLocale()
406-//
407-DWORD CIME::dwGetInputLocale()
408-{
409-#define SUBKEY _T("SOFTWARE\\Microsoft\\Input\\Locales")
410-#define VALUE _T("InputLocale")
411- DWORD dwInputLocale = 0;
412- CRegistry* CReg = new CRegistry;
413- if (CReg) {
414- if (!CReg->bReadSystemRegValueDWORD(HKEY_LOCAL_MACHINE, SUBKEY, VALUE, &dwInputLocale)) {
415- }
416- delete CReg;
417- }
418- return (dwInputLocale & 0x0000ffff);
419-#undef SUBKEY
420-#undef VALUE
421-}
422-
423-//
424-// hklGetInputLocale()
425-//
426-HKL CIME::hklGetInputLocale(HWND hWndObserved)
427-{
428-
429- DWORD dwProcessID = 0;
430- DWORD dwThreadID = 0;
431- HKL hkl = NULL;
432- DWORD dwInputLocale = 0;
433- if ((dwThreadID = GetWindowThreadProcessId(hWndObserved, &dwProcessID)) != 0) {
434- if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) {
435- int iKeyboardType = GetKeyboardType(1);
436- if ((iKeyboardType != 2) || (hkl != JP_IME)) hkl = US_ENG;
437- hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK));
438- return hkl;
439- }
440- }
441- return (HKL)0;
442-#undef SUBKEY
443-#undef VALUE
444-}
445-
446-//S
44753 // class CCursor
44854 //
44955 CCursor::CCursor()
45056 {
45157 this->hMainWnd = NULL;
45258
453- // DLL data の初期化
45459 hModDll = NULL;
45560 iCursorDataLoadCount = 0;
45661
@@ -460,6 +65,7 @@ CCursor::CCursor()
46065 stIMECursorData.bDrawNearCaret = FALSE;
46166 stIMECursorData.lpszLoadDatName = NULL;
46267 stIMECursorData.lpstFlushMouseCursor = (LPFLUSHMOUSECURSOR)&stFlushMouseCursor;
68+
46369 stIMECursorData.hWnd = NULL;
46470
46571 IMECursorChangeThread = NULL;
@@ -472,27 +78,27 @@ CCursor::CCursor()
47278 CCursor::~CCursor()
47379 {
47480 if (DrawIMEModeCaretThread != NULL) {
475- delete DrawIMEModeCaretThread; // Draw IME Mode near by Caret cursor Threadの後始末
81+ delete DrawIMEModeCaretThread;
47682 DrawIMEModeCaretThread = NULL;
47783 }
47884 if (CaretWindow != NULL) {
479- delete CaretWindow; // Draw Window near by Caret cursorの削除
85+ delete CaretWindow;
48086 CaretWindow = NULL;
48187 }
48288 if (DrawIMEModeThread != NULL) {
483- delete DrawIMEModeThread; // Draw IME Mode near by Mouse cursor Threadの後始末
89+ delete DrawIMEModeThread;
48490 DrawIMEModeThread = NULL;
48591 }
48692 if (CursorWindow != NULL) {
487- delete CursorWindow; // Draw Window near by Mouse cursorの削除
93+ delete CursorWindow;
48894 CursorWindow = NULL;
48995 }
49096 if (IMECursorChangeThread != NULL) {
491- delete IMECursorChangeThread; // IME Cursor Change Threadの後始末
97+ delete IMECursorChangeThread;
49298 IMECursorChangeThread = NULL;
49399 }
494100 if (stIMECursorData.lpszLoadDatName != NULL) {
495- delete[] stIMECursorData.lpszLoadDatName;
101+ delete [] stIMECursorData.lpszLoadDatName;
496102 stIMECursorData.lpszLoadDatName = NULL;
497103 }
498104 }
@@ -528,7 +134,7 @@ BOOL CCursor::bInitialize(HWND hWnd)
528134 if (!bChangeFlushMouseCursor(IMEOFF, &stIMECursorData)) return FALSE;
529135 if (!bRegisterIMECursorChangeThread(hWnd)) return FALSE;
530136
531-#define WINDOWCLASS _T("FlushMouseCursorWindow-{9395A3BE-4280-4AA1-9099-ADD712F982A1}")
137+#define WINDOWCLASS _T("FlushMouseCursorWindow-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}")
532138 if (CursorWindow == NULL) {
533139 CursorWindow = new CCursorWindow;
534140 if (!CursorWindow->bRegister((HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), WINDOWCLASS, stIMECursorData.dwNearDrawMouseColor)) return FALSE;
@@ -536,8 +142,7 @@ BOOL CCursor::bInitialize(HWND hWnd)
536142 DrawIMEModeThread = new CThread;
537143 }
538144 #undef WINDOWCLASS
539-
540-#define WINDOWCLASS _T("FlushMouseCaretWindow-{D40AF72E-E0D9-47DA-8A0E-7E29F6F763E4}")
145+#define WINDOWCLASS _T("FlushMouseCaretWindow-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}")
541146 if (CaretWindow == NULL) {
542147 CaretWindow = new CCursorWindow;
543148 if (!CaretWindow->bRegister((HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE), WINDOWCLASS, stIMECursorData.dwNearDrawCaretColor)) return FALSE;
@@ -548,7 +153,6 @@ BOOL CCursor::bInitialize(HWND hWnd)
548153
549154 if (!bRegisterDrawIMEModeThread(hWnd)) return FALSE;
550155 if (!bStartIMECursorChangeThread(hWnd)) return FALSE;
551-
552156 return TRUE;
553157 }
554158
@@ -559,43 +163,52 @@ LPTSTR CCursor::lpszGetCursorDataName()
559163 {
560164 LPTSTR lpszCursorDataName = NULL;
561165 LPTSTR lpszBuffer = new TCHAR[_MAX_PATH];
562- ZeroMemory(lpszBuffer, _MAX_PATH);
563- DWORD dwSize = 0;
564- GetCurrentDirectory(_MAX_PATH, lpszBuffer);
565- _tcsncat_s(lpszBuffer, _MAX_PATH, _T("\\"), sizeof(_T("\\")));
566- _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDAT, sizeof(FLUSHMOUSECURSORDAT));
567- dwSize = ExpandEnvironmentStrings(lpszBuffer, NULL, 0);
568- lpszCursorDataName = new TCHAR[dwSize];
569- ZeroMemory(lpszCursorDataName, dwSize);
570- dwSize = ExpandEnvironmentStrings(lpszBuffer, lpszCursorDataName, dwSize);
571- if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) { // Try Current Dir
572- delete [] lpszCursorDataName;
166+ if (lpszBuffer) {
573167 ZeroMemory(lpszBuffer, _MAX_PATH);
574- _tcsncat_s(lpszBuffer, _MAX_PATH, _T("%APPDATA%"), sizeof(_T("%APPDATA%")));
575- _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDIR, sizeof(FLUSHMOUSECURSORDIR));
168+ DWORD dwSize = 0;
169+ GetCurrentDirectory(_MAX_PATH, lpszBuffer);
170+ _tcsncat_s(lpszBuffer, _MAX_PATH, _T("\\"), sizeof(_T("\\")));
576171 _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDAT, sizeof(FLUSHMOUSECURSORDAT));
577172 dwSize = ExpandEnvironmentStrings(lpszBuffer, NULL, 0);
578173 lpszCursorDataName = new TCHAR[dwSize];
579- ZeroMemory(lpszCursorDataName, dwSize);
580- dwSize = ExpandEnvironmentStrings(lpszBuffer, lpszCursorDataName, dwSize);
581- if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) { // Try %APPDATA% Dir
582- delete [] lpszCursorDataName;
583- ZeroMemory(lpszBuffer, _MAX_PATH);
584- _tcsncat_s(lpszBuffer, _MAX_PATH, _T("%ALLUSERSPROFILE%"), sizeof(_T("%ALLUSERSPROFILE%")));
585- _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDIR, sizeof(FLUSHMOUSECURSORDIR));
586- _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDAT, sizeof(FLUSHMOUSECURSORDAT));
587- dwSize = ExpandEnvironmentStrings(lpszBuffer, NULL, 0);
588- lpszCursorDataName = new TCHAR[dwSize];
174+ if (lpszCursorDataName) {
589175 ZeroMemory(lpszCursorDataName, dwSize);
590176 dwSize = ExpandEnvironmentStrings(lpszBuffer, lpszCursorDataName, dwSize);
591- if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) { // Try %ALLUSERSPROFILE% Dir
592- delete [] lpszBuffer;
593- delete [] lpszCursorDataName;
594- return NULL;
177+ if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) {
178+ delete[] lpszCursorDataName;
179+ lpszCursorDataName = NULL;
180+ ZeroMemory(lpszBuffer, _MAX_PATH);
181+ _tcsncat_s(lpszBuffer, _MAX_PATH, _T("%APPDATA%"), sizeof(_T("%APPDATA%")));
182+ _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDIR, sizeof(FLUSHMOUSECURSORDIR));
183+ _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDAT, sizeof(FLUSHMOUSECURSORDAT));
184+ dwSize = ExpandEnvironmentStrings(lpszBuffer, NULL, 0);
185+ lpszCursorDataName = new TCHAR[dwSize];
186+ if (lpszCursorDataName) {
187+ ZeroMemory(lpszCursorDataName, dwSize);
188+ dwSize = ExpandEnvironmentStrings(lpszBuffer, lpszCursorDataName, dwSize);
189+ if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) {
190+ delete[] lpszCursorDataName;
191+ lpszCursorDataName = NULL;
192+ ZeroMemory(lpszBuffer, _MAX_PATH);
193+ _tcsncat_s(lpszBuffer, _MAX_PATH, _T("%ALLUSERSPROFILE%"), sizeof(_T("%ALLUSERSPROFILE%")));
194+ _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDIR, sizeof(FLUSHMOUSECURSORDIR));
195+ _tcsncat_s(lpszBuffer, _MAX_PATH, FLUSHMOUSECURSORDAT, sizeof(FLUSHMOUSECURSORDAT));
196+ dwSize = ExpandEnvironmentStrings(lpszBuffer, NULL, 0);
197+ lpszCursorDataName = new TCHAR[dwSize];
198+ if (lpszCursorDataName) {
199+ ZeroMemory(lpszCursorDataName, dwSize);
200+ dwSize = ExpandEnvironmentStrings(lpszBuffer, lpszCursorDataName, dwSize);
201+ if (GetFileAttributes(lpszCursorDataName) == INVALID_FILE_ATTRIBUTES) {
202+ delete[] lpszCursorDataName;
203+ lpszCursorDataName = NULL;
204+ }
205+ }
206+ }
207+ }
595208 }
596209 }
210+ delete[] lpszBuffer;
597211 }
598- delete [] lpszBuffer;
599212 return lpszCursorDataName;
600213 }
601214
@@ -639,6 +252,16 @@ BOOL CCursor::bStartDrawIMEModeThreadWait(HWND hWndObserved)
639252 }
640253
641254 //
255+// bStartDrawIMEModeThreadWaitEventForeGround()
256+//
257+BOOL CCursor::bStartDrawIMEModeThreadWaitEventForeGround(HWND hWndObserved)
258+{
259+ stIMECursorData.bDrawIMEModeWait = TRUE;
260+ stIMECursorData.dwWaitWaveTime = 100;
261+ return _bStartDrawIMEModeThread(hWndObserved);
262+}
263+
264+//
642265 // bStartDrawIMEModeThreadWaitDblClk()
643266 //
644267 BOOL CCursor::bStartDrawIMEModeThreadWaitDblClk(HWND hWndObserved)
@@ -649,17 +272,17 @@ BOOL CCursor::bStartDrawIMEModeThreadWaitDblClk(HWND hWndObserved)
649272 }
650273
651274 //
652-// _bStartDrawIMEModeThreadWait()
275+// _bStartDrawIMEModeThread()
653276 //
654277 BOOL CCursor::_bStartDrawIMEModeThread(HWND hWndObserved)
655278 {
656- if ((Cursor == NULL) || (DrawIMEModeThread == NULL)) return FALSE;
279+ if ((Cursor == NULL) || (DrawIMEModeThread == NULL)) return FALSE;
657280 stIMECursorData.hWnd = _hGetCaretPosByAccessibleObjectFromWindow(hWndObserved, &stIMECursorData.rcCaret);
658281 stIMECursorData.hWndObserved = hWndObserved;
659282 stIMECursorData.bDisplayFocusWindowIME = bDisplayFocusWindowIME;
660283 if (!DrawIMEModeThread->bStart()) {
661284 if (DrawIMEModeThread != NULL) {
662- delete DrawIMEModeThread; // Draw IME Mode Threadの後始末
285+ delete DrawIMEModeThread;
663286 DrawIMEModeThread = NULL;
664287 }
665288 DrawIMEModeThread = new CThread;
@@ -673,7 +296,7 @@ BOOL CCursor::_bStartDrawIMEModeThread(HWND hWndObserved)
673296 //
674297 BOOL CCursor::bShowHideCursor(HWND hWndObserved, BOOL bShow)
675298 {
676- BOOL bRet = FALSE;
299+ BOOL bRet = FALSE;
677300 if (bShow) {
678301 bRet = bStartDrawIMEModeThread(hWndObserved);
679302 }
@@ -688,10 +311,10 @@ BOOL CCursor::bShowHideCursor(HWND hWndObserved, BOOL bShow)
688311 //
689312 BOOL CCursor::bGetCaretPos(HWND hWnd, LPPOINT lpCaretPos)
690313 {
691- BOOL bRet = FALSE;
692- RECT rc{};
314+ BOOL bRet = FALSE;
315+ RECT rc{};
693316 lpCaretPos->x = 0; lpCaretPos->y = 0;
694- if (_hGetCaretPosByGuiThreadInfo(hWnd, &rc) != NULL) {
317+ if (_hGetCaretPosByAccessibleObjectFromWindow(hWnd, &rc) != NULL) {
695318 bRet = TRUE;
696319 }
697320 if (stIMECursorData.hWnd != NULL) {
@@ -738,14 +361,11 @@ BOOL CCursor::bCursorDllUnload()
738361 //
739362 BOOL CCursor::bSystemCursorLoad()
740363 {
741- // Set Flush Mouse Cursor to System
742364 if (!bChangeFlushMouseCursor(IMEOFF, &stIMECursorData)) return FALSE;
743365
744- // Set Other Mouse Cursor to System
745366 int i = 0;
746367 while (stAllMouseCursor[i].id != (DWORD)(-1)) {
747368 if (stAllMouseCursor[i].bReadReg) {
748- // Get Other System Cursor Filename from Registry
749369 if (!bGetMouseRegValue(stAllMouseCursor[i].szRegValue, stAllMouseCursor[i].szFile)) return FALSE;
750370 }
751371 i++;
@@ -772,7 +392,7 @@ BOOL CCursor::bRegisterIMECursorChangeThread(HWND hWndObserved)
772392 BOOL CCursor::bIMECursorChangeRoutine(LPVOID lpvParam)
773393 {
774394 LPIMECURSORDATA lpstCursorData = (LPIMECURSORDATA)lpvParam;
775- CCursor* This = reinterpret_cast<CCursor*>(lpvParam);
395+ CCursor *This = reinterpret_cast<CCursor*>(lpvParam);
776396 BOOL bRet = TRUE;
777397 if (lpstCursorData->bDisplayIMEModeOnCursor) {
778398 This->bIsIMECursorChanged(lpstCursorData);
@@ -808,16 +428,19 @@ BOOL CCursor::bRegisterDrawIMEModeThread(HWND hWndObserved)
808428 BOOL WINAPI CCursor::bDrawIMEModeRoutine(LPVOID lpvParam)
809429 {
810430 LPIMECURSORDATA lpstCursorData = (LPIMECURSORDATA)lpvParam;
811- CCursor* This = reinterpret_cast<CCursor*>(lpvParam);
431+ CCursor *This = reinterpret_cast<CCursor*>(lpvParam);
432+ BOOL bRet = TRUE;
812433 This->bIsIMECursorChanged(lpstCursorData);
813434 if (!This->bDrawIMEModeOnDisplay(lpstCursorData)) {
814435 _Post_equals_last_error_ DWORD err = GetLastError();
815436 if (err == ERROR_ACCESS_DENIED) {
816- return FALSE;
437+ bRet = TRUE;
438+ }
439+ else {
440+ bRet = FALSE;
817441 }
818- return FALSE;
819442 }
820- return TRUE;
443+ return bRet;
821444 }
822445
823446 //
@@ -830,7 +453,7 @@ BOOL CCursor::bIsIMECursorChanged(LPIMECURSORDATA lpstCursorData)
830453 dwIMEMode = Cime->dwIMEMode(lpstCursorData->hWndObserved, lpstCursorData->bForceHiragana);
831454 if (lpstCursorData->dwIMEModeCursor == dwIMEMode) return FALSE;
832455 lpstCursorData->dwIMEModeCursor = dwIMEMode;
833- return TRUE;
456+ return TRUE;
834457 }
835458
836459 //
@@ -841,7 +464,7 @@ BOOL CCursor::bDrawIMEModeOnDisplay(LPIMECURSORDATA lpstCursorData)
841464 BOOL bRet = FALSE;
842465 RECT rc{};
843466 if (lpstCursorData->bDrawIMEModeWait) {
844- if (lpstCursorData->dwWaitWaveTime != 0) Sleep(lpstCursorData->dwWaitWaveTime);
467+ if (lpstCursorData->dwWaitWaveTime != 0) Sleep(lpstCursorData->dwWaitWaveTime);
845468 }
846469 if (_bCalcDispModeRect(lpstCursorData->iModeSize, lpstCursorData->iModeSize, &rc)) {
847470 if (EnumDisplayMonitors(NULL, &rc, (MONITORENUMPROC)&bIconDrawEnumProc, (LPARAM)lpstCursorData) != 0) {
@@ -885,7 +508,6 @@ BOOL CCursor::bIconDrawEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, L
885508 BOOL CCursor::_bCalcDispModeRect(int iModeSizeX, int iModeSizeY, LPRECT lpRect)
886509 {
887510 POINT pt{};
888- RECT rect{};
889511 if (GetCursorPos(&pt)) {
890512 HMONITOR hMonitor = NULL;
891513 if ((hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST)) != NULL) {
@@ -894,7 +516,6 @@ BOOL CCursor::_bCalcDispModeRect(int iModeSizeX, int iModeSizeY, LPRECT lpRect)
894516 int iIconSizeX = 0, iIconSizeY = 0;
895517 iIconSizeX = iModeSizeX * (dpiX + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI + 1;
896518 iIconSizeY = iModeSizeY * (dpiY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI + 1;
897- // Draw near by Mouse cursor Left
898519 lpRect->left = pt.x - ((iIconSizeX * 3 + 1) / 2); lpRect->right = lpRect->left + iIconSizeX;
899520 lpRect->top = pt.y - ((iIconSizeY + 1) / 2); lpRect->bottom = lpRect->top + iIconSizeY;
900521 return TRUE;
@@ -913,85 +534,72 @@ BOOL CCursor::_bCalcDispModeRect(int iModeSizeX, int iModeSizeY, LPRECT lpRect)
913534 }
914535
915536 //
916-// _hGetCarePosByAccessibleObjectFromWindow()
917-//
537+// _hGetCaretPosByAccessibleObjectFromWindow()
538+//
918539 HWND CCursor::_hGetCaretPosByAccessibleObjectFromWindow(HWND hForeWnd, LPRECT lpRect)
919540 {
541+ HWND hWnd = NULL;
920542 POINT pt{};
921- RECT rcFore{}, rcTop{};
922543 DWORD dwPID = 0, dwForeThreadID = 0;
923544 if (hForeWnd != NULL) {
924- if ((dwForeThreadID = GetWindowThreadProcessId(hForeWnd, &dwPID)) != 0) {
925- GUITHREADINFO GuiThreadInfo{}; GuiThreadInfo.cbSize = sizeof(GUITHREADINFO);
926- if (GetGUIThreadInfo(dwForeThreadID, &GuiThreadInfo)) {
927- IAccessible* IAccessible = NULL;
928- if (GuiThreadInfo.hwndFocus != NULL) {
929- HRESULT hResult = AccessibleObjectFromWindow(GuiThreadInfo.hwndFocus, (DWORD)OBJID_CARET, IID_IAccessible, (LPVOID*)&IAccessible);
930- if (hResult == S_OK) {
931- SIZE sz{};
932- VARIANT variant{}; variant.vt = VT_I4; variant.lVal = CHILDID_SELF;
933- if ((hResult = IAccessible->accLocation(&pt.x, &pt.y, &sz.cx, &sz.cy, variant)) == S_OK) {
934- IAccessible->Release();
935- lpRect->left = pt.x; lpRect->top = pt.y; lpRect->right = pt.x + sz.cx; lpRect->bottom = pt.y + sz.cy;
936-#define MARGIN 2
937- if (((pt.x == 0) && (pt.y == 0)) || (pt.x <= rcTop.left + MARGIN) || (pt.y <= rcTop.top + MARGIN) || (pt.x <= rcFore.left) || (pt.y <= rcFore.top)) {
938-#undef MARGIN
939- lpRect->left = 0; lpRect->right = 0;
940- lpRect->top = 0; lpRect->bottom = 0;
941- return NULL;
942- }
943- else {
944- return GuiThreadInfo.hwndFocus;
945- }
946- }
947- }
948- }
949- }
950- }
951- }
952- return NULL;
953-}
954-
955-//
956-// _hGetCaretPosByGuiThreadInfo()
957-//
958-HWND CCursor::_hGetCaretPosByGuiThreadInfo(HWND hForeWnd, LPRECT lpRect)
959-{
960- POINT pt{};
961- RECT rcFore{}, rcTop{};
962- DWORD dwPID = 0, dwForeThreadID = 0;
963- if (hForeWnd != NULL) {
964- if (GetWindowRect(hForeWnd, &rcFore)) {
965545 if ((dwForeThreadID = GetWindowThreadProcessId(hForeWnd, &dwPID)) != 0) {
966- GUITHREADINFO GuiThreadInfo{}; GuiThreadInfo.cbSize = sizeof(GUITHREADINFO);
967- if (GetGUIThreadInfo(dwForeThreadID, &GuiThreadInfo)) {
968- if (GuiThreadInfo.hwndCaret != NULL) {
969- pt.x = GuiThreadInfo.rcCaret.left; pt.y = GuiThreadInfo.rcCaret.top;
970- if (ClientToScreen(GuiThreadInfo.hwndCaret, &pt)) {
971- lpRect->left = pt.x; lpRect->top = pt.y;
972- pt.x = GuiThreadInfo.rcCaret.right; pt.y = GuiThreadInfo.rcCaret.bottom;
973- if (ClientToScreen(GuiThreadInfo.hwndCaret, &pt)) {
974- lpRect->right = pt.x; lpRect->bottom = pt.y;
975- if (GetWindowRect(GuiThreadInfo.hwndCaret, &rcTop)) {
976-#define MARGIN 2
977- if (((pt.x == 0) && (pt.y == 0)) || (pt.x <= rcTop.left + MARGIN) || (pt.y <= rcTop.top + MARGIN) || (pt.x <= rcFore.left) || (pt.y <= rcFore.top)) {
978-#undef MARGIN
979- lpRect->left = 0; lpRect->right = 0;
980- lpRect->top = 0; lpRect->bottom = 0;
981- return NULL;
546+ LPGUITHREADINFO lpGuiThreadInfo = new GUITHREADINFO[sizeof(GUITHREADINFO)];
547+ if (lpGuiThreadInfo != NULL) {
548+ lpGuiThreadInfo->cbSize = sizeof(GUITHREADINFO);
549+ if (GetGUIThreadInfo(dwForeThreadID, lpGuiThreadInfo)) {
550+ IAccessible* IAccessible = NULL;
551+ if (lpGuiThreadInfo->hwndFocus != NULL) {
552+ HRESULT hResult = AccessibleObjectFromWindow(lpGuiThreadInfo->hwndFocus, (DWORD)OBJID_CARET, IID_IAccessible, (LPVOID*)&IAccessible);
553+ if (hResult == S_OK) {
554+ LPVARIANT lpVariant = new VARIANT[sizeof(VARIANT)];
555+ if (lpVariant != NULL) {
556+ SIZE sz{};
557+ lpVariant->vt = VT_I4; lpVariant->lVal = CHILDID_SELF;
558+ if ((hResult = IAccessible->accLocation(&pt.x, &pt.y, &sz.cx, &sz.cy, *lpVariant)) == S_OK) {
559+ IAccessible->Release();
560+ lpRect->left = pt.x; lpRect->top = pt.y; lpRect->right = pt.x + sz.cx; lpRect->bottom = pt.y + sz.cy;
561+ if ((pt.x == 0) && (pt.y == 0) && (sz.cx == 0) && (sz.cy == 0)) {
562+ lpRect->left = 0; lpRect->right = 0; lpRect->top = 0; lpRect->bottom = 0;
563+ hWnd = NULL;
564+ }
565+ else {
566+ hWnd = lpGuiThreadInfo->hwndFocus;
567+ }
982568 }
983569 else {
984- return GuiThreadInfo.hwndCaret;
570+ if (lpGuiThreadInfo->hwndCaret != NULL) {
571+ pt.x = lpGuiThreadInfo->rcCaret.left; pt.y = lpGuiThreadInfo->rcCaret.top;
572+ if (ClientToScreen(lpGuiThreadInfo->hwndCaret, &pt)) {
573+ lpRect->left = pt.x; lpRect->top = pt.y;
574+ pt.x = lpGuiThreadInfo->rcCaret.right; pt.y = lpGuiThreadInfo->rcCaret.bottom;
575+ if (ClientToScreen(lpGuiThreadInfo->hwndCaret, &pt)) {
576+ lpRect->right = pt.x; lpRect->bottom = pt.y;
577+ RECT rcFore{}, rcTop{};
578+ if (GetWindowRect(lpGuiThreadInfo->hwndCaret, &rcTop)) {
579+#define MARGIN 2
580+ if (((pt.x == 0) && (pt.y == 0)) || (pt.x <= rcTop.left + MARGIN) || (pt.y <= rcTop.top + MARGIN) || (pt.x <= rcFore.left) || (pt.y <= rcFore.top)) {
581+#undef MARGIN
582+ lpRect->left = 0; lpRect->right = 0; lpRect->top = 0; lpRect->bottom = 0;
583+ hWnd = NULL;
584+ }
585+ else {
586+ hWnd = lpGuiThreadInfo->hwndCaret;
587+ }
588+ }
589+ }
590+ }
591+ }
985592 }
593+ delete[] lpVariant;
986594 }
987595 }
988596 }
989597 }
598+ delete [] lpGuiThreadInfo;
990599 }
991600 }
992- }
993601 }
994- return NULL;
602+ return hWnd;
995603 }
996604
997605 //
@@ -1012,11 +620,12 @@ BOOL CCursor::_bAdjustCaretByMonitorDPI(int iModeSizeX, int iModeSizeY, LPRECT
1012620 lpRect->right = lpRect->left + iIconSizeX;
1013621 if ((lpRect->bottom - lpRect->top) < iModeSizeY) {
1014622 lpRect->top = (lpRect->bottom - iIconSizeY) + (DESCENT * (dpiY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
623+ lpRect->bottom = lpRect->top + iIconSizeY;
1015624 }
1016625 else {
1017- lpRect->top = (lpRect->bottom - ((lpRect->bottom - lpRect->top) / 2) - (iIconSizeY / 2));// + (DESCENT * (dpiY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
626+ lpRect->top = (lpRect->bottom - ((lpRect->bottom - lpRect->top) / 2 ) - (iIconSizeY / 2));// + (DESCENT * (dpiY + USER_DEFAULT_SCREEN_DPI - 1) / USER_DEFAULT_SCREEN_DPI);
627+ lpRect->bottom = lpRect->top + iIconSizeY;
1018628 }
1019- lpRect->bottom = lpRect->top + iIconSizeY;
1020629 #undef DESCENT
1021630 return TRUE;
1022631 }
@@ -1024,15 +633,18 @@ BOOL CCursor::_bAdjustCaretByMonitorDPI(int iModeSizeX, int iModeSizeY, LPRECT
1024633 return FALSE;
1025634 }
1026635
636+//
637+// bDrawIMEModeOnDisplaySub()
638+//
1027639 BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
1028640 {
1029641 Sleep(50);
1030-
1031- BOOL bFoundCaret = FALSE;
1032- RECT rcCursor{}, rcCaret{};
642+
643+ BOOL bFoundCaret = FALSE;
644+ RECT rcCursor{}, rcCaret{};
1033645 int iCursorSizeX = 0, iCursorSizeY = 0, iCaretSizeX = 0, iCaretSizeY = 0;
1034646 DWORD dwIMEModeCursor = IMEOFF, dwIMEModeCaret = IMEOFF;
1035- HWND hCaretWnd = NULL;
647+ HWND hCaretWnd = NULL;
1036648 if (lpstCursorData->bDrawNearCaret != FALSE) {
1037649 if (lpstCursorData->hWnd != NULL) {
1038650 rcCaret.left = lpstCursorData->rcCaret.left; rcCaret.top = lpstCursorData->rcCaret.top;
@@ -1040,7 +652,7 @@ BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
1040652 hCaretWnd = lpstCursorData->hWnd;
1041653 bFoundCaret = TRUE;
1042654 }
1043- else if ((hCaretWnd = _hGetCaretPosByGuiThreadInfo(GetForegroundWindow(), &rcCaret)) != NULL) {
655+ else if ((hCaretWnd = _hGetCaretPosByAccessibleObjectFromWindow(GetForegroundWindow(), &rcCaret)) != NULL) {
1044656 bFoundCaret = TRUE;
1045657 }
1046658 if (bFoundCaret && (hCaretWnd != NULL)) {
@@ -1088,8 +700,8 @@ BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
1088700 }
1089701
1090702 #define COUNT 10
1091- BOOL bRet = FALSE;
1092- int iCount = 0;
703+ BOOL bRet = FALSE;
704+ int iCount = 0;
1093705 if (lpstCursorData->dwDisplayModeTime != 0) iCount = (lpstCursorData->dwDisplayModeTime + (COUNT - 1)) / COUNT;
1094706 else iCount = COUNT;
1095707 for (; iCount >= 0; iCount--) {
@@ -1114,12 +726,10 @@ BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
1114726 Sleep(COUNT);
1115727 bRet = TRUE;
1116728 }
1117-
1118729 if (!CursorWindow->bSetWindowPos(HWND_BOTTOM, rcCursor.left, rcCursor.top, iCursorSizeX, iCursorSizeY, (SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS))) {
1119730 bRet = FALSE;
1120731 }
1121732 CursorWindow->vSetModeString(lpstCursorData->lpstFlushMouseCursor[0].szMode);
1122-
1123733 if (bFoundCaret) {
1124734 if (!CaretWindow->bSetWindowPos(HWND_BOTTOM, rcCaret.left, rcCaret.top, iCaretSizeX, iCaretSizeY, (SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS))) {
1125735 bRet = FALSE;
@@ -1134,11 +744,10 @@ BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
1134744 //
1135745 BOOL CCursor::bGetMouseRegValue(LPCTSTR szValue, LPTSTR szFile)
1136746 {
1137-// \HKEY_CURRENT_USER\Control Panel\Cursors
1138747 #define MOUSE_HKEY HKEY_CURRENT_USER
1139748 #define MOUSE_SUBKEY _T("Control Panel\\Cursors")
1140- BOOL bRet = FALSE;
1141- CRegistry* CReg = new CRegistry;
749+ BOOL bRet = FALSE;
750+ CRegistry *CReg = new CRegistry;
1142751 if (CReg->bReadRegValueString(MOUSE_HKEY, MOUSE_SUBKEY, szValue, szFile, _MAX_PATH)) {
1143752 bRet = TRUE;
1144753 }
@@ -1160,7 +769,7 @@ BOOL CCursor::bChangeFlushMouseCursor(UINT uCurID, LPIMECURSORDATA lpstCursorDa
1160769 if (bSetSystemCursor((LPMOUSECURSOR)&(lpstCursorData->lpstFlushMouseCursor[i]).stArrow, lpstCursorData->iCursorSize, lpstCursorData->iCursorSize)) {
1161770 if (bSetSystemCursor((LPMOUSECURSOR) & (lpstCursorData->lpstFlushMouseCursor[i]).stHand, lpstCursorData->iCursorSize, lpstCursorData->iCursorSize)) {
1162771 if (bSetSystemCursor((LPMOUSECURSOR) & (lpstCursorData->lpstFlushMouseCursor[i]).stIBeam, lpstCursorData->iCursorSize, lpstCursorData->iCursorSize)) {
1163- return TRUE; // Success
772+ return TRUE;
1164773 }
1165774 }
1166775 }
@@ -1172,29 +781,32 @@ BOOL CCursor::bChangeFlushMouseCursor(UINT uCurID, LPIMECURSORDATA lpstCursorDa
1172781 //
1173782 BOOL CCursor::bSetSystemCursor(LPMOUSECURSOR lpstMC, int iCursorSizeX, int iCursorSizeY)
1174783 {
1175- HCURSOR hCur;
1176- UINT fuLoad = 0;
1177- if (lpstMC->bReadReg) { // Load Cursor from registry
1178- if (lpstMC->szFile[0] == '\0') return TRUE;
784+ HCURSOR hCur;
785+ UINT fuLoad = 0;
786+ if (lpstMC->bReadReg) {
787+ if (lpstMC->szFile[0] == '\0') return TRUE;
1179788 fuLoad = (LR_VGACOLOR | LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_LOADFROMFILE);
1180789 if ((hCur = (HCURSOR)LoadImage(NULL, lpstMC->szFile, IMAGE_CURSOR, iCursorSizeX, iCursorSizeY, fuLoad)) == NULL) {
1181790 return FALSE;
1182791 }
1183792 } else {
1184- if (lpstMC->uResourceID == 0) { // Load Cursor from file
793+ if (lpstMC->uResourceID == 0) {
1185794 if (lpstMC->szFile[0] == '\0') return FALSE;
1186795 DWORD dwSize = 0;
1187796 dwSize = ExpandEnvironmentStrings(lpstMC->szFile, NULL, 0);
1188797 LPTSTR lpszBuffer = new TCHAR[dwSize];
1189- ZeroMemory(lpszBuffer, dwSize);
1190- dwSize = ExpandEnvironmentStrings(lpstMC->szFile, lpszBuffer, dwSize);
1191- fuLoad = (LR_VGACOLOR | LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_LOADFROMFILE);
1192- if ((hCur = (HCURSOR)LoadImage(NULL, lpszBuffer, IMAGE_CURSOR, iCursorSizeX, iCursorSizeY, fuLoad)) == NULL) {
1193- delete [] lpszBuffer;
1194- return FALSE;
798+ if (lpszBuffer) {
799+ ZeroMemory(lpszBuffer, dwSize);
800+ dwSize = ExpandEnvironmentStrings(lpstMC->szFile, lpszBuffer, dwSize);
801+ fuLoad = (LR_VGACOLOR | LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_LOADFROMFILE);
802+ if ((hCur = (HCURSOR)LoadImage(NULL, lpszBuffer, IMAGE_CURSOR, iCursorSizeX, iCursorSizeY, fuLoad)) == NULL) {
803+ delete[] lpszBuffer;
804+ return FALSE;
805+ }
806+ delete[] lpszBuffer;
1195807 }
1196- delete[] lpszBuffer;
1197- } else { // Load Cursor from DLL
808+ else return FALSE;
809+ } else {
1198810 HMODULE hMod = NULL;
1199811 if ((hMod = hCursorDllLoad()) == NULL) return FALSE;
1200812 fuLoad = (LR_VGACOLOR | LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION);
@@ -1208,11 +820,12 @@ BOOL CCursor::bSetSystemCursor(LPMOUSECURSOR lpstMC, int iCursorSizeX, int iCur
1208820 if (!bCursorDllUnload()) return FALSE;
1209821 return FALSE;
1210822 }
823+ // Unload Cursor data DLL
1211824 if (!bCursorDllUnload()) return FALSE;
1212825 }
1213826 }
1214827 if (!SetSystemCursor(hCur, lpstMC->id)) return FALSE;
1215- DestroyCursor(hCur);
828+ DestroyCursor(hCur);
1216829 return TRUE;
1217830 }
1218831
@@ -1231,12 +844,11 @@ CCursorWindow::CCursorWindow()
1231844 CCursorWindow::~CCursorWindow()
1232845 {
1233846 if (hCursorWindow != NULL) {
1234- DestroyWindow(hCursorWindow);
1235- UnregisterClass(lpszWindowClass, (HINSTANCE)GetWindowLongPtr(hCursorWindow, GWLP_HINSTANCE));
847+ PostMessage(hCursorWindow, WM_DESTROY, (WPARAM)0, (LPARAM)0);
1236848 hCursorWindow = NULL;
1237849 }
1238850 if (lpszWindowClass != NULL) {
1239- delete[] lpszWindowClass;
851+ delete [] lpszWindowClass;
1240852 lpszWindowClass = NULL;
1241853 }
1242854 }
@@ -1248,20 +860,23 @@ BOOL CCursorWindow::bRegister(HINSTANCE hInstance, LPCTSTR szWindowClassName, C
1248860 {
1249861 if (hInstance == NULL) return FALSE;
1250862 lpszWindowClass = new TCHAR[MAX_LOADSTRING];
1251- ZeroMemory(lpszWindowClass, MAX_LOADSTRING);
1252- _tcsncpy_s(lpszWindowClass, MAX_LOADSTRING, szWindowClassName, _TRUNCATE);
863+ if (lpszWindowClass) {
864+ ZeroMemory(lpszWindowClass, MAX_LOADSTRING);
865+ _tcsncpy_s(lpszWindowClass, MAX_LOADSTRING, szWindowClassName, _TRUNCATE);
1253866
1254- dwTextColor = dwRGB;
1255- if (dwRGB & 0x00000100) dwBackColor = dwRGB & 0xfffffeff;
1256- else dwBackColor = dwRGB | 0x00000100;
867+ dwTextColor = dwRGB;
868+ if (dwRGB & 0x00000100) dwBackColor = dwRGB & 0xfffffeff;
869+ else dwBackColor = dwRGB | 0x00000100;
1257870
1258- if (!MyRegisterClass(hInstance)) {
1259- return FALSE;
1260- }
1261- if ((hCursorWindow = InitInstance(hInstance, SW_HIDE)) == NULL) {
1262- return FALSE;
871+ if (!MyRegisterClass(hInstance)) {
872+ return FALSE;
873+ }
874+ if ((hCursorWindow = InitInstance(hInstance, SW_HIDE)) == NULL) {
875+ return FALSE;
876+ }
877+ return TRUE;
1263878 }
1264- return TRUE;
879+ return FALSE;
1265880 }
1266881
1267882 //
@@ -1291,22 +906,22 @@ ATOM CCursorWindow::MyRegisterClass(HINSTANCE hInstance)
1291906 #define CLASSSTYLE (CS_HREDRAW | CS_VREDRAW | CS_NOCLOSE)
1292907 WNDCLASSEX wcex{};
1293908 wcex.cbSize = sizeof(WNDCLASSEX);
1294- wcex.style = CLASSSTYLE; // クラススタイル
1295- wcex.lpfnWndProc = WndProc; // Window Proc.
1296- wcex.cbClsExtra = 0; // クラスの補足データなし
1297- wcex.cbWndExtra = 0; // ウィンドウの補足データなし
1298- wcex.hInstance = hInstance; // クラスのウィンドウハンドル
1299- wcex.hIcon = NULL; // アイコンハンドル
1300- wcex.hCursor = LoadCursor(NULL, IDC_ARROW); // マウスカーソルハンドル
1301- wcex.hbrBackground = NULL; // ウィンドウ背景色
1302- wcex.lpszMenuName = NULL; // デフォルトメニュー名
1303- wcex.lpszClassName = lpszWindowClass; // このウインドウクラスにつける名前
1304- wcex.hIconSm = NULL; // 16×16の小さいサイズのアイコン
909+ wcex.style = CLASSSTYLE;
910+ wcex.lpfnWndProc = WndProc;
911+ wcex.cbClsExtra = 0;
912+ wcex.cbWndExtra = 0;
913+ wcex.hInstance = hInstance;
914+ wcex.hIcon = NULL;
915+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
916+ wcex.hbrBackground = NULL;
917+ wcex.lpszMenuName = NULL;
918+ wcex.lpszClassName = lpszWindowClass;
919+ wcex.hIconSm = NULL;
1305920
1306921 ATOM atom = 0;
1307922 if ((atom = RegisterClassEx(&wcex)) == 0) {
1308923 _Post_equals_last_error_ DWORD err = GetLastError();
1309- if (err == 1410) return 1; // non error
924+ if (err == 1410) return 1;
1310925 }
1311926 return atom;
1312927 }
@@ -1319,20 +934,20 @@ HWND CCursorWindow::InitInstance(HINSTANCE hInstance, int nCmdShow)
1319934 #define EX_WINDOWSTYLE (WS_EX_LAYERED | WS_EX_NOACTIVATE)
1320935 #define WINDOWSTYLE (WS_POPUP)
1321936
1322- HWND hWnd = NULL; // ウィンドウのハンドル
937+ HWND hWnd = NULL;
1323938 hWnd = CreateWindowEx(
1324- EX_WINDOWSTYLE, // 拡張ウィンドウスタイル
1325- lpszWindowClass, // RegisterClass()呼び出しを参照
1326- NULL, // Title barのテキスト
1327- WINDOWSTYLE, // Window style
1328- 0, 0, // 水平・垂直位置
1329- 0, 0, // 幅・高さ
1330- NULL, // 親オーバーラップウィンドウ
1331- NULL, // ウィンドウクラスのメニューを使う
1332- hInstance, // 所有インスタンス
1333- this); // 自分のポインタを渡す
939+ EX_WINDOWSTYLE,
940+ lpszWindowClass,
941+ NULL,
942+ WINDOWSTYLE,
943+ 0, 0,
944+ 0, 0,
945+ NULL,
946+ NULL,
947+ hInstance,
948+ this);
1334949 if (!hWnd) {
1335- return NULL; // ウィンドウを作成できなかったときはNULLを返す
950+ return NULL;
1336951 }
1337952 ShowWindow(hWnd, nCmdShow);
1338953 UpdateWindow(hWnd);
@@ -1409,22 +1024,22 @@ void CCursorWindow::Cls_OnPaint(HWND hWnd)
14091024 RECT rc{};
14101025 if (GetClientRect(hWnd, &rc)) {
14111026 HBRUSH hBrush = NULL;
1412- if ((hBrush = CreateSolidBrush(dwBackColor & 0x00ffffff)) != NULL) { // 背景色を設定
1027+ if ((hBrush = CreateSolidBrush(dwBackColor & 0x00ffffff)) != NULL) {
14131028 if (SelectObject(hDC, hBrush) != HGDI_ERROR) {
14141029 if (FillRect(hDC, &rc, hBrush) != 0) {
14151030 if (SetBkMode(hDC, TRANSPARENT) != 0) {
14161031 COLORREF dwColorPrev = 0;
1417- if ((dwColorPrev = SetTextColor(hDC, dwTextColor & 0x00ffffff)) != CLR_INVALID) { // 文字色を設定
1032+ if ((dwColorPrev = SetTextColor(hDC, dwTextColor & 0x80ffffff)) != CLR_INVALID) {
14181033 int iBkModePrev = 0;
1419- if ((iBkModePrev = SetBkMode(hDC, TRANSPARENT)) != 0) { // 背景モードを設定
1034+ if ((iBkModePrev = SetBkMode(hDC, TRANSPARENT)) != 0) {
14201035 if (lpszMode != NULL) {
14211036 HFONT hFont = NULL;
14221037 DWORD dwUnderline = 0;
14231038 if (GetKeyState(VK_CAPITAL) & 0x0001) dwUnderline = TRUE; else dwUnderline = FALSE;
14241039 #define FONT _T("Yu Gothic UI")
14251040 if ((hFont = CreateFont((rc.bottom - rc.top), (rc.right - rc.left) / 2, 0, 0, FW_BOLD, FALSE, dwUnderline, FALSE,
1426- SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
1427- PROOF_QUALITY, FIXED_PITCH, FONT)) != NULL) {
1041+ SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
1042+ PROOF_QUALITY, FIXED_PITCH, FONT)) != NULL) {
14281043 HFONT hFontPrev = NULL;
14291044 if ((hFontPrev = (HFONT)SelectObject(hDC, hFont)) != NULL) {
14301045 if (DrawTextEx(hDC, lpszMode, -1, &rc, DT_RIGHT | DT_SINGLELINE | DT_VCENTER, NULL) == 0) {
--- a/FlushMouse/Cursor.h
+++ b/FlushMouse/Cursor.h
@@ -1,15 +1,18 @@
1-// Cursor.h
1+//
2+// Cursor.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/12 JeffyTS New edit.
7+// #0000 2022/03/12 JeffyTS New edit.
8+//
79
810 //
911 // Include
1012 //
1113 #pragma once
1214 #include "CommonDef.h"
15+#include "Ime.h"
1316 #include "..\FlushMouseCursor\Resource.h"
1417 #include "..\MiscLIB\CThread.h"
1518
@@ -18,17 +21,6 @@
1821 //
1922 #define IMEMODECHAR 3
2023
21-// IME mode
22-#define IMECLOSE 0x0000
23-#define IMEOPEN 0x0001
24-#define IMEOFF (IME_CMODE_ALPHANUMERIC) // 0x00 : A 英数(直接入力)
25-#define HANEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_ALPHANUMERIC) // 0x10 :_A 半角英数 0001 0000
26-#define HANKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x13 :_カ 半角カナ 0001 0011
27-#define ZENEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE) // 0x18 :A 全角英数 0001 1000
28-#define ZENHIRA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_NATIVE) // 0x19 :あ 全角ひら 0001 1001(漢字変換モード)
29-#define ZENKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x1B :カ 全角カナ 0001 1011
30-#define IMEHIDE (0x88) // 0x88 :■ Hide 1001 1000
31-
3224 #ifndef OCR_NORMAL
3325 #define OCR_NORMAL 32512 // IDC_ARROW (WinUser.h)
3426 #endif // !OCR_NORMAL
@@ -49,14 +41,14 @@
4941 #define OCR_NO 32648
5042 #if(WINVER >= 0x0500)
5143 #ifndef OCR_HAND
52-#define OCR_HAND 32649 // IDC_HAND (WinUser.h)
44+#define OCR_HAND 32649 // IDC_HAND (WinUser.h)
5345 #endif // !OCR_HAND
5446 #endif /* WINVER >= 0x0500 */
5547 #ifndef OCR_HELP
5648 #if(WINVER >= 0x0400)
5749 #define OCR_APPSTARTING 32650
5850 #endif /* WINVER >= 0x0400 */
59-#define OCR_HELP 32651 // IDC_HELP (WinUser.h)
51+#define OCR_HELP 32651 // IDC_HELP (WinUser.h)
6052 #endif // !OCR_HELP
6153 #ifndef OCR_PIN
6254 #define OCR_PIN 32671 // IDC_PIN (WinUser.h)
@@ -64,70 +56,62 @@
6456 #ifndef OCR_PERSON
6557 #define OCR_PERSON 32672 // IDC_PERSON (WinUser.h)
6658 #endif // !OCR_PERSON
67-#define OCR_HIDE 32896 // Hide Cursor
59+#define OCR_HIDE 32896 // Hide Cursor
6860
6961 //
7062 // Struct Define
7163 //
7264 typedef struct tagMOUSECURSOR {
73- DWORD id; // OCR_xxx
74- UINT uResourceID; // Resource ID
75- BOOL bReadReg; // TRUE = Read from Registry
76- TCHAR szRegValue[MAX_LOADSTRING]; // Registry Value
77- TCHAR szFile[_MAX_PATH]; // Cursor File Name
65+ DWORD id;
66+ UINT uResourceID;
67+ BOOL bReadReg;
68+ TCHAR szRegValue[MAX_LOADSTRING];
69+ TCHAR szFile[_MAX_PATH];
7870 } MOUSECURSOR, * PMOUSECURSOR, * LPMOUSECURSOR;
7971
8072 typedef struct tagFLUSHMOUSECURSOR {
81- UINT dwIMEMode; // IME Mode ID
82- TCHAR szMode[IMEMODECHAR]; // Mode Display Char
83- MOUSECURSOR stArrow; // Arrow MOUSECURSOR
84- MOUSECURSOR stHand; // Hand MOUSECURSOR
85- MOUSECURSOR stIBeam; // IBeam MOUSECURSOR
73+ DWORD dwIMEMode;
74+ TCHAR szMode[IMEMODECHAR];
75+ MOUSECURSOR stArrow;
76+ MOUSECURSOR stHand;
77+ MOUSECURSOR stIBeam;
8678 } FLUSHMOUSECURSOR, * PFLUSHMOUSECURSOR, * LPFLUSHMOUSECURSOR;
8779
8880 typedef struct tagIMECursorData
8981 {
90- // Use in Cursor
91- HWND hWndObserved;
82+ HWND hWndObserved;
9283 DWORD dwIMEModeCursor;
93- BOOL bDrawIMEModeWait;
84+ //DWORD dwIMEModeCaret;
85+ BOOL bDrawIMEModeWait;
9486 LPCTSTR lpszLoadDatName;
9587 LPFLUSHMOUSECURSOR lpstFlushMouseCursor;
9688
97- // Use in Cursor from Registry
9889 int iCursorSize;
9990 int iModeSize;
10091 DWORD dwInThreadSleepTime;
10192 DWORD dwWaitWaveTime;
10293 DWORD dwDisplayModeTime;
103- BOOL bDisplayIMEModeOnCursor;
104- BOOL bForceHiragana;
105- BOOL bDrawNearCaret;
106- COLORREF dwNearDrawCaretColor;
107- COLORREF dwNearDrawMouseColor;
108-
109- BOOL bDenyChangedByApp;
110- BOOL bUseBigArrow;
111- BOOL bDisplayFocusWindowIME;
112-
113- // Work data for Caret
114- HWND hWnd;
115- RECT rcCaret;
94+ BOOL bDisplayIMEModeOnCursor;
95+ BOOL bForceHiragana;
96+ BOOL bDrawNearCaret;
97+ COLORREF dwNearDrawCaretColor;
98+ COLORREF dwNearDrawMouseColor;
99+
100+ BOOL bDenyChangedByApp;
101+ BOOL bUseBigArrow;
102+ BOOL bDisplayFocusWindowIME;
103+
104+ HWND hWnd;
105+ RECT rcCaret;
116106 } IMECURSORDATA, * PIMECURSORDATA, * LPIMECURSORDATA;
117107
118-typedef struct tagVirtualDesktop
119-{
120- RECT rcMonitorSize;
121- int iNumOfMonitors;
122-} VIRTUALDESKTOP, * PVIRTUALDESKTOP, * LPVIRTUALDESKTOP;
123-
124108 //
125109 // Class CCursorWindow
126110 //
127111 class CCursorWindow
128112 {
129113 public:
130- CCursorWindow();
114+ CCursorWindow();
131115 ~CCursorWindow();
132116
133117 public:
@@ -140,6 +124,7 @@ private:
140124 HWND InitInstance(HINSTANCE hInstance, int nCmdShow);
141125 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
142126 LRESULT CALLBACK _WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
127+
143128 BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct);
144129 void Cls_OnDestroy(HWND hWnd);
145130 void Cls_OnPaint(HWND hWnd);
@@ -147,45 +132,11 @@ private:
147132 public:
148133
149134 private:
150- LPTSTR lpszWindowClass;
135+ LPTSTR lpszWindowClass;
151136 HWND hCursorWindow;
152- LPTSTR lpszMode;
137+ LPTSTR lpszMode;
153138 COLORREF dwTextColor;
154139 COLORREF dwBackColor;
155-
156-};
157-
158-//
159-// Class CIME
160-//
161-class CIME
162-{
163-public:
164- CIME();
165- ~CIME();
166-
167-public:
168- BOOL bIsIMEOpen(HWND hWndObserved);
169- VOID vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose);
170- VOID vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode);
171- DWORD dwIMEMode(HWND hWndObserved, BOOL bForceHiragana);
172- VOID vActivateIME(HWND hWndObserved);
173- BOOL bMoveIMEToolbar();
174- BOOL bGetVirtualDesktopSize();
175- BOOL bIsNewIME();
176- DWORD dwGetInputLocale();
177- HKL hklGetInputLocale(HWND hWndObserved);
178-
179-private:
180- BOOL bExistIMEToolbar();
181- static BOOL bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
182-
183- static BOOL CALLBACK bEnumChildProcIMEOpenClose(HWND hWnd, LPARAM lParam);
184- static BOOL CALLBACK bEnumChildProcIMEConvertMode(HWND hWnd, LPARAM lParam);
185- static BOOL CALLBACK bEnumChildProcActivateIME(HWND hWnd, LPARAM lParam);
186-
187-private:
188- LPVIRTUALDESKTOP lpstVirtualDesktop;
189140 };
190141
191142 //
@@ -202,15 +153,17 @@ public:
202153 BOOL bStartIMECursorChangeThread(HWND hWndObserved);
203154 BOOL bStartDrawIMEModeThread(HWND hWndObserved);
204155 BOOL bStartDrawIMEModeThreadWait(HWND hWndObserved);
156+ BOOL bStartDrawIMEModeThreadWaitEventForeGround(HWND hWndObserved);
205157 BOOL bStartDrawIMEModeThreadWaitDblClk(HWND hWndObserved);
158+
206159 BOOL bShowHideCursor(HWND hWndObserved, BOOL bShow);
207160 BOOL bGetCaretPos(HWND hWnd, LPPOINT lpCaretPos);
208161
209162 private:
210163 BOOL _bStartDrawIMEModeThread(HWND hWndObserved);
211164
212- LPTSTR lpszGetCursorDataName();
213- HMODULE hCursorDllLoad();
165+ LPTSTR lpszGetCursorDataName();
166+ HMODULE hCursorDllLoad();
214167 BOOL bCursorDllUnload();
215168 BOOL bSystemCursorLoad();
216169
@@ -222,10 +175,9 @@ private:
222175 BOOL bDrawIMEModeOnDisplay(LPIMECURSORDATA lpstCursorData);
223176 BOOL _bCalcDispModeRect(int iModeSizeX, int iModeSizeY, LPRECT lpRect);
224177 HWND _hGetCaretPosByAccessibleObjectFromWindow(HWND hForeWnd, LPRECT lprcCaret);
225- HWND _hGetCaretPosByGuiThreadInfo(HWND hForeWnd, LPRECT lpRect);
226178 BOOL _bAdjustCaretByMonitorDPI(int iModeSizeX, int iModeSizeY, LPRECT lprcCaret);
227179 BOOL bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData);
228- static BOOL bIconDrawEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
180+ static BOOL bIconDrawEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
229181 static BOOL WINAPI bDrawIMEModeRoutine(LPVOID lpvParam);
230182
231183 BOOL bGetMouseRegValue(LPCTSTR szValue, LPTSTR szFile);
@@ -237,66 +189,66 @@ public:
237189 private:
238190 IMECURSORDATA stIMECursorData;
239191
240- HWND hMainWnd;
192+ HWND hMainWnd;
241193 HMODULE hModDll;
242194 int iCursorDataLoadCount;
243195
244- CThread* IMECursorChangeThread;
245- CThread* DrawIMEModeThread;
246- CThread* DrawIMEModeCaretThread;
247- CCursorWindow* CursorWindow;
248- CCursorWindow* CaretWindow;
249-
250- MOUSECURSOR stAllMouseCursor[sizeof(MOUSECURSOR) * 19] = {
251- { OCR_APPSTARTING, 0, TRUE, _T("AppStarting"), _T("") },
252- { OCR_NORMAL, 0, FALSE, _T("Arrow"), _T("") },
253- { OCR_CROSS, 0, TRUE, _T("Crosshair"), _T("") },
254- { OCR_HAND, 0, FALSE, _T("Hand"), _T("") },
255- { OCR_HELP, 0, TRUE, _T("Help"), _T("") },
256- { OCR_IBEAM, 0, FALSE, _T("IBeam"), _T("") },
257- { OCR_NO, 0, TRUE, _T("No"), _T("") },
258- // { OCR_NWPEN, 0, TRUE, _T("NWPen"), _T("") },
259- // { OCR_PEN, 0, TRUE, _T("Pen"), _T("") },
260- { OCR_PERSON, 0, TRUE, _T("Person"), _T("") },
261- { OCR_PIN, 0, TRUE, _T("Pin"), _T("") },
262- { OCR_SIZEALL, 0, TRUE, _T("SizeAll"), _T("") },
263- { OCR_SIZENESW, 0, TRUE, _T("SizeNESW"), _T("") },
264- { OCR_SIZENS, 0, TRUE, _T("SizeNS"), _T("") },
265- { OCR_SIZENWSE, 0, TRUE, _T("SizeNWSE"), _T("") },
266- { OCR_SIZEWE, 0, TRUE, _T("SizeWE"), _T("") },
267- { OCR_UP, 0, TRUE, _T("UpArrow"), _T("") },
268- { OCR_WAIT, 0, TRUE, _T("Wait"), _T("") },
269- { OCR_HIDE, 0, TRUE, _T("Hide"), _T("") },
270- { (DWORD)(-1), 0, FALSE, _T(""), _T("") } // Terminater
196+ CThread* IMECursorChangeThread;
197+ CThread* DrawIMEModeThread;
198+ CThread* DrawIMEModeCaretThread;
199+ CCursorWindow* CursorWindow;
200+ CCursorWindow* CaretWindow;
201+
202+ MOUSECURSOR stAllMouseCursor[sizeof(MOUSECURSOR) * 20] = {
203+ { OCR_APPSTARTING, 0, TRUE, _T("AppStarting"), _T("") },
204+ { OCR_NORMAL, 0, FALSE, _T("Arrow"), _T("") },
205+ { OCR_CROSS, 0, TRUE, _T("Crosshair"), _T("") },
206+ { OCR_HAND, 0, FALSE, _T("Hand"), _T("") },
207+ { OCR_HELP, 0, TRUE, _T("Help"), _T("") },
208+ { OCR_IBEAM, 0, FALSE, _T("IBeam"), _T("") },
209+ { OCR_NO, 0, TRUE, _T("No"), _T("") },
210+ // { OCR_NWPEN, 0, TRUE, _T("NWPen"), _T("") },
211+ // { OCR_PEN, 0, TRUE, _T("Pen"), _T("") },
212+ { OCR_PERSON, 0, TRUE, _T("Person"), _T("") },
213+ { OCR_PIN, 0, TRUE, _T("Pin"), _T("") },
214+ { OCR_SIZEALL, 0, TRUE, _T("SizeAll"), _T("") },
215+ { OCR_SIZENESW, 0, TRUE, _T("SizeNESW"), _T("") },
216+ { OCR_SIZENS, 0, TRUE, _T("SizeNS"), _T("") },
217+ { OCR_SIZENWSE, 0, TRUE, _T("SizeNWSE"), _T("") },
218+ { OCR_SIZEWE, 0, TRUE, _T("SizeWE"), _T("") },
219+ { OCR_UP, 0, TRUE, _T("UpArrow"), _T("") },
220+ { OCR_WAIT, 0, TRUE, _T("Wait"), _T("") },
221+ { OCR_HIDE, 0, TRUE, _T("Hide"), _T("") },
222+ { (DWORD)(-1), 0, FALSE, _T(""), _T("") }
271223 };
272224
273- FLUSHMOUSECURSOR stFlushMouseCursor[sizeof(FLUSHMOUSECURSOR) * 7] = {
274- { IMEOFF, _T("A"), {OCR_NORMAL, IDC_IMEOFF_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeOffArrow.cur")},
225+ FLUSHMOUSECURSOR stFlushMouseCursor[sizeof(FLUSHMOUSECURSOR) * 8] = {
226+ { IMEOFF, _T("A"), {OCR_NORMAL, IDC_IMEOFF_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeOffArrow.cur")},
275227 {OCR_HAND, IDC_IMEOFF_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeOffHand.cur")},
276228 {OCR_IBEAM, IDC_IMEOFF_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeOffIBeam.cur")}},
277- { ZENHIRA_IMEON, _T("あ"), {OCR_NORMAL, IDC_ZENHIRA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenHiraOnArrow.cur")},
229+ { ZENHIRA_IMEON, _T("あ"), {OCR_NORMAL, IDC_ZENHIRA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenHiraOnArrow.cur")},
278230 {OCR_HAND, IDC_ZENHIRA_IMEON_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenHiraOnHand.cur")},
279231 {OCR_IBEAM, IDC_ZENHIRA_IMEON_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenHiraOnIBeam.cur")}},
280- { HANEISU_IMEON, _T("_A"), {OCR_NORMAL, IDC_HANEISU_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanEisuOnArrow.cur")},
232+ { HANEISU_IMEON, _T("_A"), {OCR_NORMAL, IDC_HANEISU_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanEisuOnArrow.cur")},
281233 {OCR_HAND, IDC_HANEISU_IMEON_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanEisuOnHand.cur")},
282234 {OCR_IBEAM, IDC_HANEISU_IMEON_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanEisuOnIBeam.cur")}},
283- { HANKANA_IMEON, _T("_ア"), {OCR_NORMAL, IDC_HANKANA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanKanaOnArrow.cur")},
235+ { HANKANA_IMEON, _T("_ア"), {OCR_NORMAL, IDC_HANKANA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanKanaOnArrow.cur")},
284236 {OCR_HAND, IDC_HANKANA_IMEON_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanKanaOnHand.cur")},
285237 {OCR_IBEAM, IDC_HANKANA_IMEON_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHanKanaOnIBeam.cur")}},
286- { ZENEISU_IMEON, _T("A"), {OCR_NORMAL, IDC_ZENEISU_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenEisuOnArrow.cur")},
238+ { ZENEISU_IMEON, _T("A"), {OCR_NORMAL, IDC_ZENEISU_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenEisuOnArrow.cur")},
287239 {OCR_HAND, IDC_ZENEISU_IMEON_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenEisuOnHand.cur")},
288240 {OCR_IBEAM, IDC_ZENEISU_IMEON_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenEisuOnIBeam.cur")}},
289- { ZENKANA_IMEON, _T("ア"), {OCR_NORMAL, IDC_ZENKANA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenKanaOnArrow.cur")},
241+ { ZENKANA_IMEON, _T("ア"), {OCR_NORMAL, IDC_ZENKANA_IMEON_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenKanaOnArrow.cur")},
290242 {OCR_HAND, IDC_ZENKANA_IMEON_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenKanaOnHand.cur")},
291243 {OCR_IBEAM, IDC_ZENKANA_IMEON_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeZenKanaOnIBeam.cur")}},
292244 { IMEHIDE, _T(""), {OCR_NORMAL, IDC_HIDE_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnArrow.cur")},
293245 {OCR_HAND, IDC_HIDE_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnHand.cur")},
294246 {OCR_IBEAM, IDC_HIDE_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnIBeam.cur")}},
295- { (DWORD)(-1), _T(""), {0, 0, FALSE, _T(""), _T("")}, // Terminater
296- {0, 0, FALSE, _T(""), _T("")}, // Terminater
297- {0, 0, FALSE, _T(""), _T("")} } // Terminater
247+ { (DWORD)(-1), _T(""), {0, 0, FALSE, _T(""), _T("")},
248+ {0, 0, FALSE, _T(""), _T("")},
249+ {0, 0, FALSE, _T(""), _T("")} }
298250 };
299-
300251 };
301252
253+
302254 /* = EOF = */
\ No newline at end of file
--- a/FlushMouse/FlushMouse.cpp
+++ b/FlushMouse/FlushMouse.cpp
@@ -1,4 +1,5 @@
1-// FlushMouse.cpp
1+//
2+// FlushMouse.cpp
23 // for Windows10/11 Win32 API msi Packaage App.
34 // Copyright (C) 1993 JeffyTS
45 //
@@ -7,8 +8,8 @@
78 //
89 // No. Date Name Reason & Document
910 // -------+-----------+-----------+-------------------------------------------- -
10-// #0000 1993/11/17 JeffyTS New edit.
11-// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
11+// #0000 1993/11/17 JeffyTS New edit.
12+// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
1213 //
1314
1415 //
@@ -21,6 +22,7 @@
2122 #include "..\version.h"
2223 #include "FlushMouseLIB.h"
2324 #include "Resource.h"
25+#include "TaskTray.h"
2426 #include "..\FlushMouseDLL\EventlogDll.h"
2527
2628 #if defined _DEBUG
@@ -41,8 +43,8 @@
4143 // Global Data
4244 //
4345 // Hook
44-TCHAR szFlushMouse64[] = _T("FlushMouseDLL.dll");
45-TCHAR szFlushMouse32[] = _T("FlushMouse32.exe");
46+TCHAR szFlushMouseDLL[] = FLUSHMOUSE_DLL;
47+TCHAR szFlushMouse32[] = FLUSHMOUSE32_EXE;
4648
4749 //
4850 // Local Data
--- a/FlushMouse/FlushMouse.h
+++ b/FlushMouse/FlushMouse.h
@@ -1,10 +1,11 @@
1-// FlushMouse.h
1+//
2+// FlushMouse.h
23 // Copyright (C) 1993 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 1993/11/17 JeffyTS New edit.
7-// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
7+// #0000 1993/11/17 JeffyTS New edit.
8+// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
89 //
910
1011 //
@@ -23,5 +24,8 @@
2324 //
2425 // Global Data
2526 //
27+extern TCHAR szFlushMouseDLL[];
28+extern TCHAR szFlushMouse32[];
29+
2630
2731 /* = EOF = */
\ No newline at end of file
--- a/FlushMouse/FlushMouse.vcxproj
+++ b/FlushMouse/FlushMouse.vcxproj
@@ -218,18 +218,22 @@
218218 <ClInclude Include="FlushMouseLIB.h" />
219219 <ClInclude Include="FlushMouseSub.h" />
220220 <ClInclude Include="framework.h" />
221+ <ClInclude Include="Ime.h" />
221222 <ClInclude Include="pch.h" />
222223 <ClInclude Include="Profile.h" />
223224 <ClInclude Include="Resource.h" />
224225 <ClInclude Include="targetver.h" />
226+ <ClInclude Include="TaskTray.h" />
225227 </ItemGroup>
226228 <ItemGroup>
227229 <ClCompile Include="FlushMouse.cpp" />
228230 <ClCompile Include="Cursor.cpp" />
229231 <ClCompile Include="FlushMouseLIB.cpp" />
230232 <ClCompile Include="FlushMouseSub.cpp" />
233+ <ClCompile Include="Ime.cpp" />
231234 <ClCompile Include="pch.cpp" />
232235 <ClCompile Include="Profile.cpp" />
236+ <ClCompile Include="TaskTray.cpp" />
233237 </ItemGroup>
234238 <ItemGroup>
235239 <ResourceCompile Include="FlushMouse.rc" />
--- a/FlushMouse/FlushMouse.vcxproj.filters
+++ b/FlushMouse/FlushMouse.vcxproj.filters
@@ -45,6 +45,12 @@
4545 <ClInclude Include="CommonDef.h">
4646 <Filter>ヘッダー ファイル</Filter>
4747 </ClInclude>
48+ <ClInclude Include="Ime.h">
49+ <Filter>ヘッダー ファイル</Filter>
50+ </ClInclude>
51+ <ClInclude Include="TaskTray.h">
52+ <Filter>ヘッダー ファイル</Filter>
53+ </ClInclude>
4854 </ItemGroup>
4955 <ItemGroup>
5056 <ClCompile Include="FlushMouse.cpp">
@@ -65,6 +71,12 @@
6571 <ClCompile Include="FlushMouseLIB.cpp">
6672 <Filter>ソース ファイル</Filter>
6773 </ClCompile>
74+ <ClCompile Include="Ime.cpp">
75+ <Filter>ソース ファイル</Filter>
76+ </ClCompile>
77+ <ClCompile Include="TaskTray.cpp">
78+ <Filter>ソース ファイル</Filter>
79+ </ClCompile>
6880 </ItemGroup>
6981 <ItemGroup>
7082 <ResourceCompile Include="FlushMouse.rc">
--- a/FlushMouse/FlushMouseLIB.cpp
+++ b/FlushMouse/FlushMouseLIB.cpp
@@ -1,9 +1,10 @@
1+//
12 // FlushMouseLIB.cpp
23 // Copyright (C) 1993 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/07/09 JeffyTS New edit.
7+// #0000 2022/07/09 JeffyTS New edit.
78 //
89
910 //
@@ -14,6 +15,7 @@
1415 #include "FlushMouseLIB.h"
1516 #include "FlushMouseSub.h"
1617 #include "Cursor.h"
18+#include "TaskTray.h"
1719 #include "Profile.h"
1820 #include "Resource.h"
1921 #include "CommonDef.h"
@@ -36,13 +38,13 @@
3638 // Global Data
3739 //
3840 // Hook
39-TCHAR szTitle[MAX_LOADSTRING]{}; // タイトル バーのテキスト
41+TCHAR szTitle[MAX_LOADSTRING]{};
4042 HWND hMainWnd = NULL;
4143
42-CProfile * Profile = NULL; // Profile class
43-CCursor * Cursor = NULL; // Cursor class
44-CResource * Resource = NULL; // Resource class
45-CIME * Cime = NULL; // IME class
44+CProfile *Profile = NULL;
45+CCursor *Cursor = NULL;
46+CResource *Resource = NULL;
47+CIME *Cime = NULL;
4648
4749 // Use in FlushMouse from Registry
4850 BOOL bDisplayIMEModeOnCursor = TRUE;
@@ -62,24 +64,24 @@ BOOL bIMEModeForced = FALSE;
6264 // Timer for Cursor
6365 #define FOCUSINITTIMERVALUE 200
6466 #define CHECKFOCUSTIMERID 1
65-static UINT nCheckFocusTimerTickValue = FOCUSINITTIMERVALUE; // Timer tick
66-static UINT_PTR nCheckFocusTimerID = CHECKFOCUSTIMERID; // Timer ID
67+static UINT nCheckFocusTimerTickValue = FOCUSINITTIMERVALUE;
68+static UINT_PTR nCheckFocusTimerID = CHECKFOCUSTIMERID;
6769 static UINT_PTR uCheckFocusTimer = NULL;
6870 // Timer for Poc
6971 #define PROCINITTIMERVALUE 1000
7072 #define CHECKPROCTIMERID 2
71-static UINT nCheckProcTimerTickValue = PROCINITTIMERVALUE; // Timer tick
72-static UINT_PTR nCheckProcTimerID = CHECKPROCTIMERID; // Timer ID
73+static UINT nCheckProcTimerTickValue = PROCINITTIMERVALUE;
74+static UINT_PTR nCheckProcTimerID = CHECKPROCTIMERID;
7375 static UINT_PTR uCheckProcTimer = NULL;
7476
7577 // Hook
76-static CFlushMouseHook* FlushMouseHook = NULL;
78+static CFlushMouseHook *FlushMouseHook = NULL;
7779
78-// Event Handler
79-static CEventHook* EventHook = NULL;
80+// Event Handler
81+static CEventHook *EventHook = NULL;
8082
8183 // for PowerNotification
82-static CPowerNotification* PowerNotification = NULL;
84+static CPowerNotification *PowerNotification = NULL;
8385
8486 //
8587 // Global Prototype Define
@@ -115,9 +117,9 @@ static void Cls_OnCheckExistingJPIMEEx(HWND hWnd, BOOL bEPHelper);
115117 static BOOL bSendInputSub(UINT cInputs, LPINPUT pInputs);
116118 static BOOL bKBisEP();
117119 static BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL);
118-static VOID CALLBACK vCheckFocusTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
119-static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
120-static BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam);
120+static VOID CALLBACK vCheckFocusTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
121+static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
122+static BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam);
121123
122124 //
123125 // bWinMain()
@@ -263,6 +265,9 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
263265 {
264266 UNREFERENCED_PARAMETER(lpCreateStruct);
265267 #define MessageBoxTYPE (MB_ICONSTOP | MB_OK)
268+
269+ hMainWnd = hWnd;
270+
266271 Cime = new CIME;
267272
268273 Profile = new CProfile;
@@ -274,7 +279,6 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
274279
275280 vGetSetProfileData();
276281
277- // Create Task Tray
278282 HICON hIcon = NULL;
279283 if ((hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) != NULL) {
280284 if (bCreateTaskTrayWindow(hWnd, hIcon, szTitle) == FALSE) {
@@ -293,7 +297,6 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
293297 return FALSE;
294298 }
295299
296- // for PowerNotification
297300 PowerNotification = new CPowerNotification(hWnd);
298301 if (!PowerNotification) {
299302 vMessageBox(hWnd, IDS_NOTRREGISTEVH, MessageBoxTYPE);
@@ -321,7 +324,14 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
321324 //
322325 static void Cls_OnDestroy(HWND hWnd)
323326 {
327+ vDestroyWindow(hWnd);
328+}
324329
330+//
331+// vDestroyWindow()
332+//
333+void vDestroyWindow(HWND hWnd)
334+{
325335 vStopThreadHookTimer(hWnd);
326336
327337 SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0);
@@ -340,12 +350,6 @@ static void Cls_OnDestroy(HWND hWnd)
340350 PowerNotification = NULL;
341351 }
342352
343- if (Resource != NULL) {
344- Resource->bUnload();
345- delete Resource;
346- Resource = NULL;
347- }
348-
349353 if (Cime != NULL) {
350354 delete Cime;
351355 Cime = NULL;
@@ -443,15 +447,11 @@ static void Cls_OnLButtonUpEx(HWND hWnd, int x, int y, HWND hForeground)
443447 UNREFERENCED_PARAMETER(x);
444448 UNREFERENCED_PARAMETER(y);
445449 UNREFERENCED_PARAMETER(hForeground);
446- if (bMoveIMEToolbar && (GetAsyncKeyState(VK_MENU) & 0x8000) && (GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
447- if (!Cime->bMoveIMEToolbar()) {
448- }
449- }
450450 if (bDoModeDispByMouseBttnUp) {
451451 HWND hWndObserved = NULL;
452452 POINT pt{};
453453 if (GetCursorPos(&pt)) {
454- RECT rc{};
454+ RECT rc{};
455455 if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
456456 if (FindWindow(L"Shell_TrayWnd", NULL) == GetForegroundWindow()) {
457457 if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
@@ -482,12 +482,12 @@ static void Cls_OnEventForegroundEx(HWND hWnd, DWORD dwEvent, HWND hForeWnd)
482482 if (EventHook->hFormerWnd != hForeWnd) {
483483 EventHook->hFormerWnd = hForeWnd;
484484 if (hWnd != hForeWnd) {
485- HWND hWndObserved = NULL;
485+ HWND hWndObserved = NULL;
486+ POINT pt{};
486487 if (bDisplayFocusWindowIME) {
487- hWndObserved = hWnd;
488+ hWndObserved = hForeWnd;
488489 }
489490 else {
490- POINT pt{};
491491 if (GetCursorPos(&pt)) {
492492 if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
493493 }
@@ -502,14 +502,13 @@ static void Cls_OnEventForegroundEx(HWND hWnd, DWORD dwEvent, HWND hForeWnd)
502502 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
503503 }
504504 if (!Cursor->bStartIMECursorChangeThread(hWndObserved)) return;
505- POINT pt{};
506505 if (GetCursorPos(&pt)) {
507- RECT rc{};
508- if (FindWindow(L"Shell_TrayWnd", NULL) == GetForegroundWindow()) {
506+ RECT rc{};
507+ if (FindWindow(L"Shell_TrayWnd", NULL) == hForeWnd) {
509508 if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
510509 if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
511510 }
512- if (!Cursor->bStartDrawIMEModeThreadWait(hForeWnd)) return;
511+ if (!Cursor->bStartDrawIMEModeThreadWaitEventForeGround(hForeWnd)) return;
513512 }
514513 }
515514 }
@@ -524,7 +523,7 @@ static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConverting, D
524523 UNREFERENCED_PARAMETER(hWnd);
525524 UNREFERENCED_PARAMETER(vkCode);
526525
527- HWND hWndObserved = GetForegroundWindow();
526+ HWND hWndObserved = GetForegroundWindow();
528527 POINT pt{};
529528 if (Cursor->bGetCaretPos(hWndObserved, &pt)) {
530529 if ((pt.x != 0) && (pt.y != 0)) {
@@ -532,7 +531,7 @@ static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConverting, D
532531 }
533532 }
534533 if (Cime->dwIMEMode(hWndObserved, FALSE) != IMEOFF) bIMEInConverting = bStartConverting;
535- else bIMEInConverting = FALSE;
534+ else bIMEInConverting = FALSE;
536535 }
537536
538537 //
@@ -822,7 +821,7 @@ void Cls_OnCheckExistingJPIMEEx(HWND hWnd, BOOL bEPHelper)
822821 //
823822 static BOOL bKBisEP()
824823 {
825- if (GetKeyboardType(1) == 0) { // EP Keyboard
824+ if (GetKeyboardType(1) == 0) {
826825 _Post_equals_last_error_ DWORD err = GetLastError();
827826 if (err != 0) {
828827 }
@@ -831,21 +830,19 @@ static BOOL bKBisEP()
831830 }
832831 }
833832
834- // 2nd Check
835833 DWORD dProcessID = 0;
836834 DWORD dThreadID = GetWindowThreadProcessId(GetForegroundWindow(), &dProcessID);
837835 if (dThreadID != 0) {
838836 HKL hkl = GetKeyboardLayout(dThreadID);
839- if (hkl == US_ENG) { // EP Keyboard
837+ if (hkl == US_ENG) {
840838 return TRUE;
841839 }
842840 }
843841
844- // 3rd Check
845842 #define SUBKEY _T("SOFTWARE\\Microsoft\\Input\\Locales")
846843 #define VALUE _T("InputLocale")
847- DWORD dwInputLocale = 0;
848- CRegistry* CReg = new CRegistry;
844+ DWORD dwInputLocale = 0;
845+ CRegistry *CReg = new CRegistry;
849846 if (CReg) {
850847 if (!CReg->bReadSystemRegValueDWORD(HKEY_LOCAL_MACHINE, SUBKEY, VALUE, &dwInputLocale)) {
851848 }
@@ -864,7 +861,7 @@ static BOOL bKBisEP()
864861 BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForcedChange, LPHKL lpNewHKL, LPHKL lpPreviousHKL)
865862 {
866863 if (hForeWnd == NULL) return FALSE;
867- BOOL bRet = FALSE;
864+ BOOL bRet = FALSE;
868865 HKL hkl = NULL;
869866 HKL hPreviousHKL = NULL;
870867 DWORD dwProcessID = 0;
@@ -912,7 +909,7 @@ BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForc
912909 //
913910 BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL)
914911 {
915- BOOL bRet = FALSE;
912+ BOOL bRet = FALSE;
916913 int iKBList = 0;
917914 if ((iKBList = GetKeyboardLayoutList(0, NULL)) != 0) {
918915 LPHKL lpHKL = NULL;
@@ -960,7 +957,7 @@ BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL)
960957 //
961958 BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam)
962959 {
963- HWND hIMWnd = NULL;
960+ HWND hIMWnd = NULL;
964961 if (ActivateKeyboardLayout((HKL)lParam, KLF_SETFORPROCESS) != 0) {
965962 if ((hIMWnd = ImmGetDefaultIMEWnd(hWnd)) != NULL) {
966963 SendMessage(hIMWnd, WM_INPUTLANGCHANGEREQUEST, (WPARAM)INPUTLANGCHANGE_SYSCHARSET, lParam);
@@ -974,7 +971,7 @@ BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam)
974971 //
975972 BOOL bCheckExistingJPIME()
976973 {
977- BOOL bRet = FALSE;
974+ BOOL bRet = FALSE;
978975 LPHKL lpHKL = NULL;
979976 int iKBList = 0;
980977 if ((iKBList = GetKeyboardLayoutList(0, NULL)) != 0) {
@@ -991,8 +988,15 @@ BOOL bCheckExistingJPIME()
991988 if (lpHKL) delete[] lpHKL;
992989 }
993990 }
994- HWND hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL);
995- if (hWnd != NULL) PostMessage(hWnd, WM_CHECKEXISTINGJPIMEEX, (WPARAM)bRet, (LPARAM)NULL);
991+ HWND hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL);
992+ if (hWnd != NULL) {
993+ if (bEnableEPHelper) {
994+ PostMessage(hWnd, WM_CHECKEXISTINGJPIMEEX, (WPARAM)bRet, (LPARAM)NULL);
995+ }
996+ else {
997+ PostMessage(hWnd, WM_CHECKEXISTINGJPIMEEX, (WPARAM)FALSE, (LPARAM)NULL);
998+ }
999+ }
9961000 return bRet;
9971001 }
9981002
@@ -1030,7 +1034,7 @@ BOOL bStartThreadHookTimer(HWND hWnd)
10301034 // Register Hook
10311035 if (FlushMouseHook == NULL) {
10321036 FlushMouseHook = new CFlushMouseHook;
1033- if (!FlushMouseHook->bHookSet(hWnd, szFlushMouse64, szFlushMouse32)) {
1037+ if (!FlushMouseHook->bHookSet(hWnd, szFlushMouseDLL, szFlushMouse32)) {
10341038 vMessageBox(hWnd, IDS_NOTREGISTERHOOK, MessageBoxTYPE);
10351039 PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
10361040 return FALSE;
@@ -1038,7 +1042,7 @@ BOOL bStartThreadHookTimer(HWND hWnd)
10381042 }
10391043
10401044 // Set Timer
1041- BOOL bBool = FALSE;
1045+ BOOL bBool = FALSE;
10421046 if (SetUserObjectInformation(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION, &bBool, sizeof(BOOL)) != FALSE) {
10431047 // Set Timer for Cursor
10441048 if (uCheckFocusTimer == NULL) {
@@ -1159,14 +1163,39 @@ static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DW
11591163
11601164 if (uTimerID == nCheckProcTimerID) {
11611165 if (FindWindow(CLASS_FLUSHMOUSE32, NULL) == NULL) {
1166+ vDestroyWindow(hWnd);
11621167 bReportEvent(MSG_DETECT_FLUSHMOUSE_STOP, APPLICATION_CATEGORY);
1168+ bCreateProcess(FLUSHMOUSE_EXE);
11631169 bReportEvent(MSG_RESTART_EVENT, APPLICATION_CATEGORY);
1164- PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
11651170 }
11661171 }
11671172 }
11681173
11691174 //
1175+// bCreateProcess()
1176+//
1177+BOOL bCreateProcess(LPCTSTR lpszExecName)
1178+{
1179+ BOOL bRet = FALSE;
1180+ DWORD dwSize = 0;
1181+ dwSize = ExpandEnvironmentStrings(lpszExecName, NULL, 0);
1182+ LPTSTR lpszBuffer = new TCHAR[dwSize];
1183+ if (lpszBuffer) {
1184+ ZeroMemory(lpszBuffer, dwSize);
1185+ dwSize = ExpandEnvironmentStrings(lpszExecName, lpszBuffer, dwSize);
1186+ PROCESS_INFORMATION ProcessInfomation{};
1187+ STARTUPINFO StartupInfo{}; StartupInfo.cb = sizeof(STARTUPINFO);
1188+ if (CreateProcess(lpszBuffer, NULL, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo, &ProcessInfomation) != FALSE) {
1189+ CloseHandle(ProcessInfomation.hProcess);
1190+ CloseHandle(ProcessInfomation.hThread);
1191+ bRet = TRUE;
1192+ }
1193+ delete[] lpszBuffer;
1194+ }
1195+ return bRet;
1196+}
1197+
1198+//
11701199 // Class CResource
11711200 //
11721201 CResource::CResource()
--- a/FlushMouse/FlushMouseLIB.h
+++ b/FlushMouse/FlushMouseLIB.h
@@ -32,7 +32,7 @@ private:
3232
3333 public:
3434 HMODULE hLoad();
35- BOOL bUnload();
35+ BOOL bUnload();
3636
3737 private:
3838 LPTSTR szResFile;
@@ -45,18 +45,20 @@ private:
4545 // Global Prototype Define
4646 //
4747 extern BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance);
48+extern VOID vDestroyWindow(HWND hWnd);
4849 extern BOOL bStartThreadHookTimer(HWND hWnd);
4950 extern VOID vStopThreadHookTimer(HWND hWnd);
51+extern BOOL bCreateProcess(LPCTSTR lpszExecName);
5052 extern BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForcedChange, LPHKL lpNewHKL, LPHKL lpPreviousHKL);
5153 extern BOOL bCheckExistingJPIME();
5254
5355 //
5456 // Global Data
5557 //
56-extern TCHAR szFlushMouse64[];
57-extern TCHAR szFlushMouse32[];
58+extern TCHAR szFlushMouseDLL[];
59+extern TCHAR szFlushMouse32[];
5860
59-extern TCHAR szTitle[];
61+extern TCHAR szTitle[];
6062 extern HWND hMainWnd;
6163
6264 extern BOOL bOffChangedFocus;
@@ -72,7 +74,7 @@ extern BOOL bIMEModeForced;
7274
7375 extern CProfile *Profile;
7476 extern CCursor *Cursor;
75-extern CResource *Resource;
77+extern CResource *Resource;
7678 extern CIME *Cime;
7779
7880 /* = EOF = */
\ No newline at end of file
--- a/FlushMouse/FlushMouseSub.cpp
+++ b/FlushMouse/FlushMouseSub.cpp
@@ -11,11 +11,10 @@
1111 //
1212 #pragma once
1313 #include "pch.h"
14-#include "FlushMouseLIB.h"
1514 #include "FlushMouseSub.h"
15+#include "FlushMouseLIB.h"
16+#include "TaskTray.h"
1617 #include "CommonDef.h"
17-#include "Profile.h"
18-#include "Resource.h"
1918 #include "..\FlushMouseDLL\GlobalHookDll.h"
2019 #include "..\FlushMouseDLL\KeyboardHookDll.h"
2120 #include "..\FlushMouseDLL\EventlogDll.h"
@@ -29,501 +28,14 @@
2928 //
3029 // Global Data
3130 //
32-HWND hAboutDlg = NULL;
33-HWND hSettingDlg = NULL;
34-BOOL bIMEInConverting = FALSE;
3531
3632 //
3733 // Local Data
3834 //
39-static BOOL bTaskTray = FALSE;
40-static UINT uTaskbarCreatedMessage = 0;
4135
4236 //
4337 // Local Prototype Define
4438 //
45-static INT_PTR CALLBACK SettingDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
46-static BOOL bInitDlgCenter(HWND hDlg, HICON hIcon, DWORD dwICC);
47-static BOOL bSetCheckDlgButton(HWND hDlg, int iIDButton, BOOL bCheck);
48-static VOID vSetTrackbar(HWND hDlg, int iIDTrackbar, int iRangeMin, int iRangeMax, int iTickFreq, int iPos, int iPageSize);
49-static BOOL bGetDlgButtonChecked(HWND hDlg, int iIDButton);
50-static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar);
51-
52-//
53-// bCreateTaskTrayWindow()
54-//
55-BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitle)
56-{
57- NOTIFYICONDATA nIco{};
58- nIco.cbSize = sizeof(NOTIFYICONDATA);
59- nIco.hWnd = hWnd;
60- nIco.uID = NOTIFYICONDATA_ID;
61- nIco.guidItem = GUID_NULL;
62- nIco.uFlags = NIF_INFO | NIF_MESSAGE | NIF_ICON | NIF_TIP;
63- nIco.uCallbackMessage = WM_TASKTRAYEX;
64- nIco.dwState = NIS_HIDDEN | NIS_SHAREDICON;
65- nIco.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON | NIIF_NOSOUND;
66- nIco.uVersion = NOTIFYICON_VERSION_4;
67- nIco.hIcon = hIcon;
68- if ((nIco.hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) == NULL) {
69- return FALSE;
70- }
71- _tcsncpy_s(nIco.szTip, ARRAYSIZE(nIco.szTip), lpszTitle, _TRUNCATE);
72- BOOL bRet = FALSE;
73- try {
74- throw bRet = Shell_NotifyIcon(NIM_ADD, &nIco);
75- }
76- catch (BOOL) {
77- if (!bRet) {
78- _Post_equals_last_error_ DWORD err = GetLastError();
79- if (err == ERROR_TIMEOUT) {
80- Sleep(1000);
81- try {
82- throw bRet = Shell_NotifyIcon(NIM_ADD, &nIco);
83- }
84- catch (BOOL) {
85- if (!bRet) {
86- return FALSE;
87- }
88- }
89- catch (...) {
90- return FALSE;
91- }
92- }
93- else {
94- return FALSE;
95- }
96- }
97- }
98- catch (...) {
99- return FALSE;
100- }
101-
102- if ((uTaskbarCreatedMessage = RegisterWindowMessage(_T("TaskbarCreated"))) == 0) {
103- bDestroyTaskTrayWindow(hWnd);
104- return FALSE;
105- }
106- bTaskTray = TRUE;
107- return TRUE;
108-}
109-
110-//
111-// bReCreateTaskTrayWindow()
112-//
113-BOOL bReCreateTaskTrayWindow(HWND hWnd, UINT message)
114-{
115- if (message == uTaskbarCreatedMessage) {
116- if (bDestroyTaskTrayWindow(hWnd)) {
117- bTaskTray = FALSE;
118- }
119- HICON hIcon = NULL;
120- if ((hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) != NULL) {
121- if (bCreateTaskTrayWindow(hWnd, hIcon, szTitle) == FALSE) {
122- bTaskTray = TRUE;
123- vStopThreadHookTimer(hWnd);
124- if (!bStartThreadHookTimer(hWnd)) {
125- bReportEvent(MSG_THREAD_HOOK_TIMER_RESTART_FAILED, APPLICATION_CATEGORY);// Eventlog
126- PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
127- }
128- bReportEvent(MSG_THREAD_HOOK_TIMER_RESTARTED, APPLICATION_CATEGORY);
129- return TRUE;
130- }
131- else {
132- if (bDestroyTaskTrayWindow(hWnd)) {
133- bTaskTray = FALSE;
134- }
135- bReportEvent(MSG_TASKTRAY_REGISTER_FAILD, APPLICATION_CATEGORY);// Eventlog
136- bReportEvent(MSG_RESTART_EVENT, APPLICATION_CATEGORY);
137- return TRUE;
138- }
139- }
140- else {
141- return FALSE;
142- }
143- }
144- return TRUE;
145-}
146-
147-//
148-// bDestroyTaskTrayWindow()
149-//
150-BOOL bDestroyTaskTrayWindow(HWND hWnd)
151-{
152- if (bTaskTray != FALSE) {
153- NOTIFYICONDATA nIco{};
154- nIco.cbSize = sizeof(NOTIFYICONDATA);
155- nIco.hWnd = hWnd;
156- nIco.uID = NOTIFYICONDATA_ID;
157- nIco.guidItem = GUID_NULL;
158- nIco.uFlags = 0;
159- try {
160- throw Shell_NotifyIcon(NIM_DELETE, &nIco);
161- }
162- catch (BOOL bRet) {
163- if (bRet) {
164- bTaskTray = FALSE;
165- return TRUE;
166- }
167- else {
168- return FALSE;
169- }
170- }
171- catch (...) {
172- return FALSE;
173- }
174- }
175- return TRUE;
176-}
177-
178-//
179-// bGetTaskTrayWindowRect()
180-//
181-BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect)
182-{
183- if (bTaskTray != FALSE) {
184- NOTIFYICONIDENTIFIER nii{};
185- nii.cbSize = sizeof(NOTIFYICONIDENTIFIER);
186- nii.hWnd = hWnd;
187- nii.uID = NOTIFYICONDATA_ID;
188- nii.guidItem = GUID_NULL;
189- try {
190- throw Shell_NotifyIconGetRect(&nii, lpRect);
191- }
192- catch (HRESULT hResult) {
193- if (hResult != S_OK) {
194- return FALSE;
195- }
196- return TRUE;
197- }
198- catch (...) {
199- PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
200- return FALSE;
201- }
202- }
203- return FALSE;
204-}
205-
206-//
207-// WM_TASKTRAYEX
208-// Cls_OnTaskTrayEx()
209-//
210-void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
211-{
212- if (id != NOTIFYICONDATA_ID) {
213- return;
214- }
215- switch (uMsg) {
216- case WM_LBUTTONDOWN:
217- if (bOffChangedFocus) {
218- Cime->vIMEOpenCloseForced(hWnd, IMECLOSE);
219- }
220- [[fallthrough]]; // fallthrough is explicit
221- //break;
222- case WM_RBUTTONDOWN:
223- bDisplayIMEModeOnCursor = FALSE;
224- bDoModeDispByMouseBttnUp = FALSE;
225- bDrawNearCaret = FALSE;
226-
227- // Display menu when left & right button is clicked on task tray icon.
228- POINT pt{};
229- GetCursorPos(&pt);
230- HMENU hMenu = LoadMenu(Resource->hLoad(), MAKEINTRESOURCE(IDR_TT_MENU));
231- HMENU hSubMenu = GetSubMenu(hMenu, 0);
232- SetForegroundWindow(hWnd);
233- APPBARDATA stAppBarData{};
234- stAppBarData.cbSize = sizeof(APPBARDATA);
235- stAppBarData.hWnd = hWnd;
236- SHAppBarMessage(ABM_GETTASKBARPOS, &stAppBarData);
237- UINT uFlags = 0;
238- switch (stAppBarData.uEdge) {
239- case ABE_TOP:
240- uFlags = TPM_RIGHTALIGN | TPM_TOPALIGN;
241- if (pt.y < stAppBarData.rc.bottom) pt.y = stAppBarData.rc.bottom;
242- break;
243- case ABE_BOTTOM:
244- uFlags = TPM_RIGHTALIGN | TPM_BOTTOMALIGN;
245- if (pt.y > stAppBarData.rc.top) pt.y = stAppBarData.rc.top;
246- break;
247- case ABE_LEFT:
248- uFlags = TPM_LEFTALIGN | TPM_BOTTOMALIGN;
249- if (pt.x < stAppBarData.rc.right) pt.x = stAppBarData.rc.right;
250- break;
251- case ABE_RIGHT:
252- uFlags = TPM_RIGHTALIGN | TPM_BOTTOMALIGN;
253- if (pt.x > stAppBarData.rc.left) pt.x = stAppBarData.rc.left;
254- break;
255- }
256- if (hAboutDlg != NULL) {
257- //EnableMenuItem(hSubMenu, IDR_TT_ABOUT, MF_BYCOMMAND | MF_DISABLED);
258- }
259- if (hSettingDlg != NULL) {
260- //EnableMenuItem(hSubMenu, IDR_TT_SETTING, MF_BYCOMMAND | MF_DISABLED);
261- }
262- TrackPopupMenu(hSubMenu, uFlags, pt.x, pt.y, 0, hWnd, NULL);
263- break;
264- }
265-}
266-
267-//
268-// vSettingDialog()
269-//
270-VOID vSettingDialog(HWND hWnd)
271-{
272- if (hSettingDlg != NULL) {
273- SetForegroundWindow(hSettingDlg);
274- return;
275- }
276- DialogBox(Resource->hLoad(), MAKEINTRESOURCE(IDD_SETTING), hWnd, SettingDlg);
277-}
278-
279-//
280-// SettingDlg()
281-//
282-static INT_PTR CALLBACK SettingDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
283-{
284- UNREFERENCED_PARAMETER(lParam);
285- switch (message) {
286- case WM_INITDIALOG:
287- hSettingDlg = hDlg;
288- { // Initialize
289- HICON hIcon = (HICON)LoadImage(Resource->hLoad(), MAKEINTRESOURCE(IDI_SMALL), IMAGE_ICON, 16, 16, 0);
290- bInitDlgCenter(hDlg, hIcon, (ICC_BAR_CLASSES | ICC_HOTKEY_CLASS));
291- }
292- { // Combo Box
293- TCHAR lpText[MAX_LOADSTRING];
294- if (LoadString(Resource->hLoad(), IDS_CMBX_LIST01, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
295- SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)lpText);
296- if (LoadString(Resource->hLoad(), IDS_CMBX_LIST02, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
297- SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)lpText);
298- }
299- { // Check Box
300- bSetCheckDlgButton(hDlg, IDC_CHECK1, Profile->lpstAppRegData->bDisplayIMEModeOnCursor);
301- bSetCheckDlgButton(hDlg, IDC_CHECK2, Profile->lpstAppRegData->bOffChangedFocus);
302- bSetCheckDlgButton(hDlg, IDC_CHECK3, Profile->lpstAppRegData->bForceHiragana);
303- bSetCheckDlgButton(hDlg, IDC_CHECK4, Profile->lpstAppRegData->bDoModeDispByIMEKeyDown);
304- bSetCheckDlgButton(hDlg, IDC_CHECK5, Profile->lpstAppRegData->bDoModeDispByMouseBttnUp);
305- bSetCheckDlgButton(hDlg, IDC_CHECK6, Profile->lpstAppRegData->bDoModeDispByCtrlUp);
306- bSetCheckDlgButton(hDlg, IDC_CHECK7, Profile->lpstAppRegData->bDrawNearCaret);
307- bSetCheckDlgButton(hDlg, IDC_CHECK8, Profile->lpstAppRegData->bEnableEPHelper);
308- }
309- { // Track Bar
310- vSetTrackbar(hDlg, IDC_SLIDER1, 16, 64, 8, Profile->lpstAppRegData->iCursorSize, 8);
311- vSetTrackbar(hDlg, IDC_SLIDER2, 8, 64, 8, Profile->lpstAppRegData->iModeSize, 8);
312- vSetTrackbar(hDlg, IDC_SLIDER3, 100, 800, 70, Profile->lpstAppRegData->dwDisplayModeTime, 70);
313- vSetTrackbar(hDlg, IDC_SLIDER4, 0, 1000, 100, Profile->lpstAppRegData->dwWaitWaveTime, 100);
314- if (IsDlgButtonChecked(hDlg, IDC_CHECK3) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0) {
315- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
316- }
317- else {
318- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
319- }
320- if (IsDlgButtonChecked(hDlg, IDC_CHECK4) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
321- else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
322- }
323- { // 既定の動作
324- if (Profile->lpstAppRegData->bDisplayFocusWindowIME) {
325- SendDlgItemMessage(hDlg, IDC_COMBO1, CB_SETCURSEL, 0, 0);
326- //EnableWindow(GetDlgItem(hDlg, IDC_CHECK2), TRUE);
327- }
328- else {
329- SendDlgItemMessage(hDlg, IDC_COMBO1, CB_SETCURSEL, 1, 0);
330- //CheckDlgButton(hDlg, IDC_CHECK2, BST_UNCHECKED);
331- //EnableWindow(GetDlgItem(hDlg, IDC_CHECK2), FALSE);
332- }
333- }
334- SetFocus(GetDlgItem(hDlg, IDC_CHECK1));
335- return (INT_PTR)TRUE;
336- case WM_HSCROLL:
337- { // Track Bar
338- if ((GetDlgItem(hDlg, IDC_SLIDER1) == (HWND)lParam)
339- || (GetDlgItem(hDlg, IDC_SLIDER2) == (HWND)lParam)
340- || (GetDlgItem(hDlg, IDC_SLIDER3) == (HWND)lParam)
341- || (GetDlgItem(hDlg, IDC_SLIDER4) == (HWND)lParam)) {
342- EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
343- }
344- }
345- break;
346- case WM_CTLCOLORDLG:
347- return (INT_PTR)GetStockObject(WHITE_BRUSH); // 背景の色
348- case WM_CTLCOLORSTATIC:
349- case WM_CTLCOLOREDIT:
350- SetBkMode(((HDC)wParam), TRANSPARENT);
351- SetTextColor(((HDC)wParam), RGB(0, 0, 0)); // 文字の色
352- return (INT_PTR)GetStockObject(WHITE_BRUSH); // 背景の色
353- case WM_COMMAND:
354- switch (LOWORD(wParam)) {
355- case IDC_CHECK4:
356- case IDC_CHECK5:
357- case IDC_CHECK6:
358- if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK5) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK6) == 0) {
359- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
360- }
361- else {
362- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
363- }
364- if (IsDlgButtonChecked(hDlg, IDC_CHECK6) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
365- else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
366- [[fallthrough]]; // fallthrough is explicit
367- case IDC_CHECK1:
368- case IDC_CHECK2:
369- case IDC_CHECK3:
370- case IDC_CHECK7:
371- case IDC_CHECK8:
372- EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
373- break;
374- case IDC_COMBO1:
375- if (HIWORD(wParam) == CBN_SELCHANGE) {
376- switch (SendDlgItemMessage(hDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0)) {
377- case 0:
378- //EnableWindow(GetDlgItem(hDlg, IDC_CHECK2), TRUE);
379- break;
380- case 1:
381- if (IsDlgButtonChecked(hDlg, IDC_CHECK2) != 0) {
382- //CheckDlgButton(hDlg, IDC_CHECK2, BST_UNCHECKED);
383- }
384- //EnableWindow(GetDlgItem(hDlg, IDC_CHECK2), FALSE);
385- break;
386- default:
387- break;
388- }
389- EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
390- }
391- break;
392- case IDC_BUTTON1:
393- SetFocus(GetDlgItem(hDlg, IDC_CHECK1));
394- if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK5) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK6) == 0) {
395- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
396- }
397- else {
398- EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
399- }
400- if (IsDlgButtonChecked(hDlg, IDC_CHECK6) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
401- else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
402- [[fallthrough]]; // fallthrough is explicit
403- case IDOK:
404- Profile->lpstAppRegData->bDisplayIMEModeOnCursor = bGetDlgButtonChecked(hDlg, IDC_CHECK1);
405- Profile->lpstAppRegData->bOffChangedFocus = bGetDlgButtonChecked(hDlg, IDC_CHECK2);
406- Profile->lpstAppRegData->bForceHiragana = bGetDlgButtonChecked(hDlg, IDC_CHECK3);
407- Profile->lpstAppRegData->bDoModeDispByIMEKeyDown = bGetDlgButtonChecked(hDlg, IDC_CHECK4);
408- Profile->lpstAppRegData->bDoModeDispByMouseBttnUp = bGetDlgButtonChecked(hDlg, IDC_CHECK5);
409- Profile->lpstAppRegData->bDoModeDispByCtrlUp = bGetDlgButtonChecked(hDlg, IDC_CHECK6);
410- Profile->lpstAppRegData->bDrawNearCaret = bGetDlgButtonChecked(hDlg, IDC_CHECK7);
411- Profile->lpstAppRegData->bEnableEPHelper = bGetDlgButtonChecked(hDlg, IDC_CHECK8);
412- Profile->lpstAppRegData->iCursorSize = (int)dwGetTrackbarPos(hDlg, IDC_SLIDER1);
413- Profile->lpstAppRegData->iModeSize = (int)dwGetTrackbarPos(hDlg, IDC_SLIDER2);
414- Profile->lpstAppRegData->dwDisplayModeTime = dwGetTrackbarPos(hDlg, IDC_SLIDER3);
415- Profile->lpstAppRegData->dwWaitWaveTime = dwGetTrackbarPos(hDlg, IDC_SLIDER4);
416- switch (SendDlgItemMessage(hDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0)) {
417- case 0:
418- Profile->lpstAppRegData->bDisplayFocusWindowIME = TRUE;
419- break;
420- case 1:
421- Profile->lpstAppRegData->bDisplayFocusWindowIME = FALSE;
422- break;
423- default:
424- break;
425- }
426- if (Profile != NULL) {
427- Profile->bSetProfileData(); // Set Registry data
428- }
429- vStopThreadHookTimer(hMainWnd);
430- if (!bStartThreadHookTimer(hMainWnd)) {
431- PostMessage(hMainWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
432- return (INT_PTR)FALSE;
433- }
434- if (LOWORD(wParam) == IDC_BUTTON1) {
435- EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), FALSE);
436- return (INT_PTR)FALSE;
437- }
438- [[fallthrough]]; // fallthrough is explicit
439- case IDCANCEL:
440- EndDialog(hDlg, LOWORD(wParam));
441- if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) hSettingDlg = NULL;
442- return (INT_PTR)TRUE;
443- }
444- }
445- return (INT_PTR)FALSE;
446-}
447-
448-//
449-// bInitDlgCenter()
450-//
451-static BOOL bInitDlgCenter(HWND hDlg, HICON hIcon, DWORD dwICC)
452-{
453- int cx = GetSystemMetrics(SM_CXSCREEN);
454- int cy = GetSystemMetrics(SM_CYSCREEN);
455- RECT rc{};
456- GetWindowRect(hDlg, (LPRECT)&rc);
457- rc.right = rc.right - rc.left + 1; rc.bottom = rc.bottom - rc.top + 1;
458- rc.left = (cx - rc.right) / 2; rc.top = (cy - rc.bottom) / 2;
459- MoveWindow(hDlg, rc.left, rc.top, rc.right, rc.bottom, TRUE);
460- SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
461-
462- // Initialize
463- INITCOMMONCONTROLSEX stICC{};
464- stICC.dwSize = sizeof(INITCOMMONCONTROLSEX);
465- stICC.dwICC = dwICC;
466- return InitCommonControlsEx(&stICC);
467-}
468-
469-//
470-// bSetCheckDlgButton()
471-//
472-static BOOL bSetCheckDlgButton(HWND hDlg, int iIDButton, BOOL bCheck)
473-{
474- UINT uCheck = 0;
475- if (bCheck) uCheck = BST_CHECKED;
476- else uCheck = BST_UNCHECKED;
477- if (!CheckDlgButton(hDlg, iIDButton, uCheck)) {
478- return FALSE;
479- }
480- return TRUE;
481-}
482-
483-//
484-// vSetTrackbar()
485-//
486-static VOID vSetTrackbar(HWND hDlg, int iIDTrackbar, int iRangeMin, int iRangeMax, int iTickFreq, int iPos, int iPageSize)
487-{
488- SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETRANGE, TRUE, MAKELPARAM(iRangeMin, iRangeMax));
489- SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETTICFREQ, iTickFreq, 0);
490- SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETPOS, TRUE, iPos);
491- SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETPAGESIZE, 0, iPageSize);
492-}
493-
494-//
495-// bGetDlgButtonChecked()
496-//
497-static BOOL bGetDlgButtonChecked(HWND hDlg, int iIDButton)
498-{
499- if (IsDlgButtonChecked(hDlg, iIDButton) == 0) return FALSE;
500- else return TRUE;
501-}
502-
503-//
504-// dwGetTrackbarPos()
505-//
506-static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar)
507-{
508- return (DWORD)SendDlgItemMessage(hDlg, iIDTrackbar, TBM_GETPOS, NULL, NULL);
509-}
510-
511-//
512-// vGetSetProfileData()
513-//
514-VOID vGetSetProfileData()
515-{
516- bDisplayIMEModeOnCursor = Profile->lpstAppRegData->bDisplayIMEModeOnCursor;
517- bOffChangedFocus = Profile->lpstAppRegData->bOffChangedFocus;
518- bDisplayFocusWindowIME = Profile->lpstAppRegData->bDisplayFocusWindowIME;
519- bDoModeDispByIMEKeyDown = Profile->lpstAppRegData->bDoModeDispByIMEKeyDown;
520- bDoModeDispByMouseBttnUp = Profile->lpstAppRegData->bDoModeDispByMouseBttnUp;
521- bDoModeDispByCtrlUp = Profile->lpstAppRegData->bDoModeDispByCtrlUp;
522- bDrawNearCaret = Profile->lpstAppRegData->bDrawNearCaret;
523- bEnableEPHelper = Profile->lpstAppRegData->bEnableEPHelper;
524- bMoveIMEToolbar = Profile->lpstAppRegData->bMoveIMEToolbar;
525- bIMEModeForced = Profile->lpstAppRegData->bIMEModeForced;
526-}
52739
52840 //
52941 // class CPowerNotification
@@ -583,11 +95,16 @@ BOOL CPowerNotification::PowerBroadcast(HWND hWnd, ULONG Type, POWERBROADCAST_S
58395 case 0:
58496 bReportEvent(MSG_PBT_APMPOWERSTATUSCHANGE_AC_OFF, POWERNOTIFICATION_CATEGORY);
58597 Sleep(3000);
586- bReportEvent(MSG_RESTART_EVENT, POWERNOTIFICATION_CATEGORY);
587- bDestroyTaskTrayWindow(hWnd);
98+ vDestroyWindow(hWnd);
99+ bCreateProcess(FLUSHMOUSE_EXE);
100+ bReportEvent(MSG_RESTART_EVENT, POWERNOTIFICATION_CATEGORY);
588101 break;
589102 case 1:
590103 bReportEvent(MSG_PBT_APMPOWERSTATUSCHANGE_AC_ON, POWERNOTIFICATION_CATEGORY);
104+ Sleep(3000);
105+ vDestroyWindow(hWnd);
106+ bCreateProcess(FLUSHMOUSE_EXE);
107+ bReportEvent(MSG_RESTART_EVENT, POWERNOTIFICATION_CATEGORY);
591108 break;
592109 default:
593110 break;
@@ -637,19 +154,19 @@ BOOL CEventHook::bEventSet()
637154 {
638155 #define EVENT_FLAGS (WINEVENT_OUTOFCONTEXT)
639156 hEventHook = SetWinEventHook(
640- EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, // Range of events
641- NULL, // Handle to DLL.
642- &vHandleEvent, // The callback.
643- 0, 0, // Process and thread IDs of interest (0 = all)
644- EVENT_FLAGS); // Flags.
157+ EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
158+ NULL,
159+ &vHandleEvent,
160+ 0, 0,
161+ EVENT_FLAGS);
645162 if (hEventHook == NULL) return FALSE;
646163
647164 hEventHookIME = SetWinEventHook(
648- EVENT_OBJECT_TEXTSELECTIONCHANGED, EVENT_OBJECT_TEXTEDIT_CONVERSIONTARGETCHANGED, // Range of events
649- NULL, // Handle to DLL.
650- &vHandleEventIME, // The callback.
651- 0, 0, // Process and thread IDs of interest (0 = all)
652- EVENT_FLAGS); // Flags.
165+ EVENT_OBJECT_TEXTSELECTIONCHANGED, EVENT_OBJECT_TEXTEDIT_CONVERSIONTARGETCHANGED,
166+ NULL,
167+ &vHandleEventIME,
168+ 0, 0,
169+ EVENT_FLAGS);
653170 if (hEventHookIME == NULL) return FALSE;
654171
655172 return TRUE;
@@ -741,8 +258,10 @@ CFlushMouseHook::CFlushMouseHook()
741258 CFlushMouseHook::~CFlushMouseHook()
742259 {
743260 bHookUnset();
744- if (lpstProcessInfomation) delete[] lpstProcessInfomation;
745- lpstProcessInfomation = NULL;
261+ if (lpstProcessInfomation) {
262+ delete[] lpstProcessInfomation;
263+ lpstProcessInfomation = NULL;
264+ }
746265 }
747266 //
748267 // bHookSet()
@@ -778,7 +297,7 @@ BOOL CFlushMouseHook::bHookUnset()
778297 BOOL CFlushMouseHook::bHook32DllStart(HWND hWnd, LPCTSTR lpszExec32Name)
779298 {
780299 #define COMAMANDLINESIZE (sizeof(_T(" ")) * (sizeof(unsigned long long) + 1))
781- BOOL bRet = FALSE;
300+ BOOL bRet = FALSE;
782301 DWORD dwSize = 0;
783302 dwSize = ExpandEnvironmentStrings(lpszExec32Name, NULL, 0);
784303 LPTSTR lpszBuffer = new TCHAR[dwSize];
@@ -813,7 +332,7 @@ BOOL CFlushMouseHook::bHook32DllStart(HWND hWnd, LPCTSTR lpszExec32Name)
813332 BOOL CFlushMouseHook::bHook32DllStop()
814333 {
815334 #define TIMEOUT 1000
816- if (!bHook32Dll) return TRUE;
335+ if (!bHook32Dll) return TRUE;
817336 BOOL bRet = FALSE;
818337 if (lpstProcessInfomation != NULL) {
819338 if (lpstProcessInfomation->hProcess != NULL) {
--- a/FlushMouse/FlushMouseSub.h
+++ b/FlushMouse/FlushMouseSub.h
@@ -1,9 +1,10 @@
1-// FlushMouseSub.h
1+//
2+// FlushMouseSub.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/03 JeffyTS New edit.
7+// #0000 2022/03/03 JeffyTS New edit.
78 //
89
910 //
@@ -23,22 +24,10 @@
2324 //
2425 // Global Data
2526 //
26-extern HWND hAboutDlg;
27-extern HWND hSettingDlg;
28-extern BOOL bIMEInConverting;
2927
3028 //
3129 // Global Prototype Define
3230 //
33-extern BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitile);
34-extern BOOL bReCreateTaskTrayWindow(HWND hWnd, UINT message);
35-extern BOOL bDestroyTaskTrayWindow(HWND hWnd);
36-extern BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect);
37-extern void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg);
38-extern void vMessageBox(HWND hWnd, UINT uID, UINT uType);
39-extern VOID vAboutDialog(HWND hWnd);
40-extern VOID vSettingDialog(HWND hWnd);
41-extern VOID vGetSetProfileData();
4231
4332 //
4433 // class CEventHook
@@ -46,8 +35,9 @@ extern VOID vGetSetProfileData();
4635 class CEventHook
4736 {
4837 public:
49- CEventHook();
50- ~CEventHook();
38+ CEventHook();
39+ ~CEventHook();
40+
5141 BOOL bEventSet();
5242 BOOL bEventUnset();
5343
@@ -56,7 +46,7 @@ private:
5646 static void CALLBACK vHandleEventIME(HWINEVENTHOOK hook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
5747
5848 public:
59- HWND hFormerWnd;
49+ HWND hFormerWnd;
6050
6151 private:
6252 HWINEVENTHOOK hEventHook;
@@ -71,12 +61,13 @@ class CPowerNotification
7161 public:
7262 CPowerNotification(HWND hWnd);
7363 ~CPowerNotification();
64+
7465 BOOL PowerBroadcast(HWND hWnd, ULONG Type, POWERBROADCAST_SETTING* lpSetting);
7566
7667 private:
77- HPOWERNOTIFY hSuspendResumeNotification;
78- HPOWERNOTIFY hPowerSettingNotification;
79- GUID guidPowerSettingNotification;
68+ HPOWERNOTIFY hSuspendResumeNotification;
69+ HPOWERNOTIFY hPowerSettingNotification;
70+ GUID guidPowerSettingNotification;
8071 };
8172
8273 //
@@ -97,10 +88,10 @@ private:
9788
9889 private:
9990 HMODULE hHook64Dll;
100- BOOL bGlobalHook64;
101- BOOL bKeyboardHookLL64;
102- BOOL bMouseHook64;
103- BOOL bHook32Dll;
91+ BOOL bGlobalHook64;
92+ BOOL bKeyboardHookLL64;
93+ BOOL bMouseHook64;
94+ BOOL bHook32Dll;
10495
10596 private:
10697 LPPROCESS_INFORMATION lpstProcessInfomation;
--- /dev/null
+++ b/FlushMouse/Ime.cpp
@@ -0,0 +1,327 @@
1+//
2+// Ime.cpp
3+// Copyright (C) 2022 JeffyTS
4+//
5+// No. Date Name Reason & Document
6+// -------+-----------+-----------+-------------------------------------------- -
7+// #0000 2022/03/03 JeffyTS New edit.
8+// #0001 2023/06/30 JeffyTS Divided from cursor.cpp
9+//
10+
11+// Include
12+//
13+#pragma once
14+#include "pch.h"
15+#include "Ime.h"
16+#include "CommonDef.h"
17+#include "..\MiscLIB\CRegistry.h"
18+
19+//
20+// Library
21+//
22+
23+//
24+// Define
25+//
26+
27+//
28+// Struct Define
29+//
30+
31+//
32+// Class Define
33+
34+//
35+// Local Data
36+//
37+
38+//
39+// Class CIME
40+//
41+CIME::CIME()
42+{
43+ lpstVirtualDesktop = new VIRTUALDESKTOP[sizeof(VIRTUALDESKTOP)];
44+ if (lpstVirtualDesktop != NULL) {
45+ ZeroMemory(lpstVirtualDesktop, sizeof(VIRTUALDESKTOP));
46+ bGetVirtualDesktopSize();
47+ }
48+}
49+CIME::~CIME()
50+{
51+ if (lpstVirtualDesktop != NULL) delete[] lpstVirtualDesktop;
52+ lpstVirtualDesktop = NULL;
53+}
54+
55+//
56+// bIsIMEOpen()
57+//
58+BOOL CIME::bIsIMEOpen(HWND hWndObserved)
59+{
60+ HWND hIMWnd = NULL;
61+ if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
62+ if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETOPENSTATUS, (LPARAM)NULL) != 0) {
63+ return TRUE;
64+ }
65+ }
66+ return FALSE;
67+}
68+
69+//
70+// vIMEOpenCloseForced()
71+//
72+VOID CIME::vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose)
73+{
74+ if (hWndObserved == NULL) return;
75+ LPARAM lParam = (LPARAM)dwIMEOpenClose;
76+ EnumChildWindows(hWndObserved, &bEnumChildProcIMEOpenClose, lParam);
77+ return;
78+}
79+
80+//
81+// vIMEConvertModeChangeForced()
82+//
83+VOID CIME::vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode)
84+{
85+ if (hWndObserved == NULL) return;
86+ LPARAM lParam = (LPARAM)dwConvertMode;
87+ EnumChildWindows(hWndObserved, &bEnumChildProcIMEConvertMode, lParam);
88+ return;
89+}
90+
91+//
92+// bEnumChildProcIMEConvertMode()
93+//
94+BOOL CALLBACK CIME::bEnumChildProcIMEConvertMode(HWND hWndObserved, LPARAM lParam)
95+{
96+ if (hWndObserved == NULL) return FALSE;
97+ HWND hIMWnd = NULL;
98+ if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
99+ if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETOPENSTATUS, (LPARAM)TRUE) == 0) {
100+ if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETCONVERSIONMODE, (LPARAM)lParam) == 0) {
101+ }
102+ }
103+ }
104+ return TRUE;
105+}
106+
107+//
108+// bEnumChildProcIMEOpenClose()
109+//
110+BOOL CALLBACK CIME::bEnumChildProcIMEOpenClose(HWND hWndObserved, LPARAM lParam)
111+{
112+ if (hWndObserved == NULL) return FALSE;
113+ HWND hIMWnd = NULL;
114+ if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
115+ if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_SETOPENSTATUS, lParam) == 0) {
116+ }
117+ }
118+ return TRUE;
119+}
120+
121+//
122+// dwIMEMode()
123+//
124+DWORD CIME::dwIMEMode(HWND hWndObserved, BOOL bForceHiragana)
125+{
126+ if (hWndObserved != NULL) {
127+ HWND hIMWnd = NULL;
128+ HKL hkl = NULL;
129+ DWORD dwInputLocale = 0;
130+ DWORD dwConvertMode = 0;
131+ if ((hIMWnd = ImmGetDefaultIMEWnd(hWndObserved)) != NULL) {
132+ if (SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETOPENSTATUS, NULL) != 0) {
133+ if ((dwConvertMode = (DWORD)SendMessage(hIMWnd, WM_IME_CONTROL, (WPARAM)IMC_GETCONVERSIONMODE, NULL)) != 0) {
134+ switch (dwConvertMode) {
135+ case IME_CMODE_NATIVE:
136+ dwConvertMode = IMEOFF;
137+ break;
138+ case ZENHIRA_IMEON:
139+ case (ZENHIRA_IMEON ^ IME_CMODE_ROMAN):
140+ dwConvertMode = ZENHIRA_IMEON;
141+ break;
142+ case HANEISU_IMEON:
143+ case (HANEISU_IMEON ^ IME_CMODE_ROMAN):
144+ dwConvertMode = HANEISU_IMEON;
145+ break;
146+ case HANKANA_IMEON:
147+ case (HANKANA_IMEON ^ IME_CMODE_ROMAN):
148+ dwConvertMode = HANKANA_IMEON;
149+ break;
150+ case ZENEISU_IMEON:
151+ case (ZENEISU_IMEON ^ IME_CMODE_ROMAN):
152+ dwConvertMode = ZENEISU_IMEON;
153+ break;
154+ case ZENKANA_IMEON:
155+ case (ZENKANA_IMEON ^ IME_CMODE_ROMAN):
156+ dwConvertMode = ZENKANA_IMEON;
157+ break;
158+ default:
159+ dwConvertMode = IMEOFF;
160+ }
161+ if ((bForceHiragana != FALSE) && (dwConvertMode != ZENHIRA_IMEON)) {
162+ vIMEConvertModeChangeForced(hWndObserved, ZENHIRA_IMEON);
163+ dwConvertMode = ZENHIRA_IMEON;
164+ }
165+ if ((hkl = hklGetInputLocale(hWndObserved)) != (HKL)0) {
166+ if ((dwInputLocale = dwGetInputLocale()) != 0) {
167+ if ((hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK))) != JP_IME) {
168+ dwConvertMode = IMEOFF;
169+ }
170+ }
171+ }
172+ return dwConvertMode;
173+ }
174+ }
175+ }
176+ }
177+ return IMEOFF;
178+}
179+
180+//
181+// vActivateIME()
182+//
183+VOID CIME::vActivateIME(HWND hWndObserved)
184+{
185+ EnumChildWindows(hWndObserved, &bEnumChildProcActivateIME, NULL);
186+}
187+
188+//
189+// bEnumChildProcActivateIME()
190+//
191+BOOL CALLBACK CIME::bEnumChildProcActivateIME(HWND hWnd, LPARAM lParam)
192+{
193+ UNREFERENCED_PARAMETER(lParam);
194+
195+ HWND hIMWnd = ImmGetDefaultIMEWnd(hWnd);
196+ if (hIMWnd != NULL) {
197+ SendMessage(hIMWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
198+ LPTSTR lpszBuffer = new TCHAR[_MAX_PATH];
199+ if (lpszBuffer) {
200+ ZeroMemory(lpszBuffer, (sizeof(TCHAR) * _MAX_PATH));
201+ if (GetClassName(hIMWnd, lpszBuffer, _MAX_PATH) != 0) {
202+ HWND hIMEWnd = FindWindow(lpszBuffer, NULL);
203+ if (hIMEWnd != NULL) {
204+ SendMessage(hIMEWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
205+ delete[] lpszBuffer;
206+ return TRUE;
207+ }
208+ }
209+ delete[] lpszBuffer;
210+ }
211+ }
212+ return TRUE;
213+}
214+
215+
216+//
217+// bGetVirtualDesktopSize()
218+//
219+BOOL CIME::bGetVirtualDesktopSize()
220+{
221+ BOOL bRet = FALSE;
222+ if (lpstVirtualDesktop != NULL) {
223+ ZeroMemory(lpstVirtualDesktop, sizeof(VIRTUALDESKTOP));
224+ if (EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)&bGetVirtualDesktopSizeEnumProc, (LPARAM)lpstVirtualDesktop) != 0) {
225+ bRet = TRUE;
226+ }
227+ else {
228+ _Post_equals_last_error_ DWORD err = GetLastError();
229+ if ((err == ERROR_INVALID_PARAMETER) || (err == ERROR_SUCCESS)) {
230+ bRet = TRUE;
231+ }
232+ else if (err == ERROR_ACCESS_DENIED) {
233+ // error but be able to On Sleep
234+ bRet = TRUE;
235+ }
236+ }
237+ }
238+ return bRet;
239+}
240+
241+//
242+// bGetVirtualDesktopSizeEnumProc()
243+//
244+BOOL CIME::bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam)
245+{
246+ UNREFERENCED_PARAMETER(hDC);
247+ UNREFERENCED_PARAMETER(lprcClip);
248+ LPVIRTUALDESKTOP lpstVirtualDesktop = (LPVIRTUALDESKTOP)lParam;
249+ //CIME* This = reinterpret_cast<CIME*>(lParam);
250+ MONITORINFO stMonInfo{}; stMonInfo.cbSize = sizeof(MONITORINFO);
251+ if (GetMonitorInfo(hMonitor, &stMonInfo) != 0) {
252+ if (stMonInfo.rcMonitor.left <= lpstVirtualDesktop->rcMonitorSize.left) lpstVirtualDesktop->rcMonitorSize.left = stMonInfo.rcMonitor.left;
253+ if (stMonInfo.rcMonitor.right >= lpstVirtualDesktop->rcMonitorSize.right) lpstVirtualDesktop->rcMonitorSize.right = stMonInfo.rcMonitor.right;
254+ if (stMonInfo.rcMonitor.top <= lpstVirtualDesktop->rcMonitorSize.top) lpstVirtualDesktop->rcMonitorSize.top = stMonInfo.rcMonitor.top;
255+ if (stMonInfo.rcMonitor.bottom >= lpstVirtualDesktop->rcMonitorSize.bottom) lpstVirtualDesktop->rcMonitorSize.bottom = stMonInfo.rcMonitor.bottom;
256+ ++lpstVirtualDesktop->iNumOfMonitors;
257+ return TRUE;
258+ }
259+ return FALSE;
260+}
261+
262+//
263+// bIsNewIME()
264+//
265+//
266+BOOL CIME::bIsNewIME()
267+{
268+#define SUBKEY _T("Software\\Microsoft\\input\\tsf\\tsf3override\\{03b5835f-f03c-411b-9ce2-aa23e1171e36}")
269+#define VALUE _T("NoTsf3Override2")
270+ CRegistry* CReg = new CRegistry;
271+ if (CReg) {
272+ DWORD dwCTF = 0;
273+ if (!CReg->bReadSystemRegValueDWORD(HKEY_CURRENT_USER, SUBKEY, VALUE, &dwCTF)) {
274+ dwCTF = 0;
275+ }
276+ delete CReg;
277+ if (dwCTF != 0) return FALSE;
278+ else return TRUE;
279+ }
280+ return FALSE;
281+#undef SUBKEY
282+#undef VALUE
283+}
284+
285+//
286+// dGetInputLocale()
287+//
288+DWORD CIME::dwGetInputLocale()
289+{
290+#define SUBKEY _T("SOFTWARE\\Microsoft\\Input\\Locales")
291+#define VALUE _T("InputLocale")
292+ DWORD dwInputLocale = 0;
293+ CRegistry* CReg = new CRegistry;
294+ if (CReg) {
295+ if (!CReg->bReadSystemRegValueDWORD(HKEY_LOCAL_MACHINE, SUBKEY, VALUE, &dwInputLocale)) {
296+ }
297+ delete CReg;
298+ }
299+ return (dwInputLocale & 0x0000ffff);
300+#undef SUBKEY
301+#undef VALUE
302+}
303+
304+//
305+// hklGetInputLocale()
306+//
307+HKL CIME::hklGetInputLocale(HWND hWndObserved)
308+{
309+
310+ DWORD dwProcessID = 0;
311+ DWORD dwThreadID = 0;
312+ HKL hkl = NULL;
313+ DWORD dwInputLocale = 0;
314+ if ((dwThreadID = GetWindowThreadProcessId(hWndObserved, &dwProcessID)) != 0) {
315+ if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) {
316+ int iKeyboardType = GetKeyboardType(1);
317+ if ((iKeyboardType != 2) || (hkl != JP_IME)) hkl = US_ENG;
318+ hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK));
319+ return hkl;
320+ }
321+ }
322+ return (HKL)0;
323+#undef SUBKEY
324+#undef VALUE
325+}
326+
327+/* = EOF = */
\ No newline at end of file
--- /dev/null
+++ b/FlushMouse/Ime.h
@@ -0,0 +1,72 @@
1+// Ime.h
2+// Copyright (C) 2022 JeffyTS
3+//
4+// No. Date Name Reason & Document
5+// -------+-----------+-----------+-------------------------------------------- -
6+// #0000 2022/03/12 JeffyTS New edit.
7+// #0001 2023/06/30 JeffyTS Divided from cursor.h
8+
9+//
10+// Include
11+//
12+#pragma once
13+#include "pch.h"
14+
15+//
16+// Define
17+//
18+#define IMEMODECHAR 3
19+
20+// IME mode
21+#define IMECLOSE 0x0000
22+#define IMEOPEN 0x0001
23+#define IMEOFF (IME_CMODE_ALPHANUMERIC) // 0x00 : A 英数(直接入力)
24+#define HANEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_ALPHANUMERIC) // 0x10 :_A 半角英数 0001 0000
25+#define HANKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x13 :_カ 半角カナ 0001 0011
26+#define ZENEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE) // 0x18 :A 全角英数 0001 1000
27+#define ZENHIRA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_NATIVE) // 0x19 :あ 全角ひら 0001 1001(漢字変換モード)
28+#define ZENKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x1B :カ 全角カナ 0001 1011
29+#define IMEHIDE (0x88) // 0x88 :■ Hide 1001 1000
30+
31+//
32+// Struct Define
33+//
34+typedef struct tagVirtualDesktop
35+{
36+ RECT rcMonitorSize;
37+ int iNumOfMonitors;
38+} VIRTUALDESKTOP, * PVIRTUALDESKTOP, * LPVIRTUALDESKTOP;
39+
40+//
41+// Class CIME
42+//
43+class CIME
44+{
45+public:
46+ CIME();
47+ ~CIME();
48+
49+public:
50+ BOOL bIsIMEOpen(HWND hWndObserved);
51+ VOID vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose);
52+ VOID vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode);
53+ DWORD dwIMEMode(HWND hWndObserved, BOOL bForceHiragana);
54+ VOID vActivateIME(HWND hWndObserved);
55+ BOOL bGetVirtualDesktopSize();
56+ BOOL bIsNewIME();
57+ DWORD dwGetInputLocale();
58+ HKL hklGetInputLocale(HWND hWndObserved);
59+
60+private:
61+ static BOOL bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
62+
63+ static BOOL CALLBACK bEnumChildProcIMEOpenClose(HWND hWnd, LPARAM lParam);
64+ static BOOL CALLBACK bEnumChildProcIMEConvertMode(HWND hWnd, LPARAM lParam);
65+ static BOOL CALLBACK bEnumChildProcActivateIME(HWND hWnd, LPARAM lParam);
66+
67+private:
68+ LPVIRTUALDESKTOP lpstVirtualDesktop;
69+};
70+
71+
72+/* = EOF = */
\ No newline at end of file
--- a/FlushMouse/Profile.cpp
+++ b/FlushMouse/Profile.cpp
@@ -1,9 +1,10 @@
1-// Profile.cpp
1+//
2+// Profile.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/23 JeffyTS New edit.
7+// #0000 2022/03/23 JeffyTS New edit.
78 //
89
910 //
--- a/FlushMouse/Profile.h
+++ b/FlushMouse/Profile.h
@@ -1,9 +1,10 @@
1-// Profile.h
1+//
2+// Profile.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/23 JeffyTS New edit.
7+// #0000 2022/03/23 JeffyTS New edit.
78 //
89
910 //
--- /dev/null
+++ b/FlushMouse/TaskTray.cpp
@@ -0,0 +1,527 @@
1+//
2+// TaskTray.cpp
3+// Copyright (C) 2022 JeffyTS
4+//
5+// No. Date Name Reason & Document
6+// -------+-----------+-----------+-------------------------------------------- -
7+// #0000 2022/03/03 JeffyTS New edit.
8+// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.cpp
9+//
10+
11+// Include
12+//
13+#pragma once
14+#include "pch.h"
15+#include "TaskTray.h"
16+#include "CommonDef.h"
17+#include "Resource.h"
18+#include "FlushMouseLIB.h"
19+#include "..\FlushMouseDLL\EventlogDll.h"
20+
21+//
22+// Library
23+//
24+
25+//
26+// Define
27+//
28+
29+//
30+// Struct Define
31+//
32+
33+//
34+// Global Data
35+//
36+HWND hAboutDlg = NULL;
37+HWND hSettingDlg = NULL;
38+BOOL bIMEInConverting = FALSE;
39+
40+//
41+// Local Data
42+//
43+static BOOL bTaskTray = FALSE;
44+static UINT uTaskbarCreatedMessage = 0;
45+
46+//
47+// Local Prototype Define
48+//
49+static INT_PTR CALLBACK SettingDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
50+static BOOL bInitDlgCenter(HWND hDlg, HICON hIcon, DWORD dwICC);
51+static BOOL bSetCheckDlgButton(HWND hDlg, int iIDButton, BOOL bCheck);
52+static VOID vSetTrackbar(HWND hDlg, int iIDTrackbar, int iRangeMin, int iRangeMax, int iTickFreq, int iPos, int iPageSize);
53+static BOOL bGetDlgButtonChecked(HWND hDlg, int iIDButton);
54+static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar);
55+
56+//
57+// bCreateTaskTrayWindow()
58+//
59+BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitle)
60+{
61+ NOTIFYICONDATA nIco{};
62+ nIco.cbSize = sizeof(NOTIFYICONDATA);
63+ nIco.hWnd = hWnd;
64+ nIco.uID = NOTIFYICONDATA_ID;
65+ nIco.guidItem = GUID_NULL;
66+ nIco.uFlags = NIF_INFO | NIF_MESSAGE | NIF_ICON | NIF_TIP;
67+ nIco.uCallbackMessage = WM_TASKTRAYEX;
68+ nIco.dwState = NIS_HIDDEN | NIS_SHAREDICON;
69+ nIco.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON | NIIF_NOSOUND;
70+ nIco.uVersion = NOTIFYICON_VERSION_4;
71+ nIco.hIcon = hIcon;
72+ if ((nIco.hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) == NULL) {
73+ return FALSE;
74+ }
75+ _tcsncpy_s(nIco.szTip, ARRAYSIZE(nIco.szTip), lpszTitle, _TRUNCATE);
76+ try {
77+ throw Shell_NotifyIcon(NIM_ADD, &nIco);
78+ }
79+ catch (BOOL bRet) {
80+ if (!bRet) {
81+ _Post_equals_last_error_ DWORD err = GetLastError();
82+ if (err == ERROR_TIMEOUT) {
83+ Sleep(1000);
84+ try {
85+ throw Shell_NotifyIcon(NIM_ADD, &nIco);
86+ }
87+ catch (BOOL bRet) {
88+ if (!bRet) {
89+ return FALSE;
90+ }
91+ }
92+ catch (...) {
93+ return FALSE;
94+ }
95+ }
96+ else {
97+ return FALSE;
98+ }
99+ }
100+ }
101+ catch (...) {
102+ return FALSE;
103+ }
104+
105+ if ((uTaskbarCreatedMessage = RegisterWindowMessage(_T("TaskbarCreated"))) == 0) {
106+ bDestroyTaskTrayWindow(hWnd);
107+ return FALSE;
108+ }
109+ bTaskTray = TRUE;
110+ return TRUE;
111+}
112+
113+
114+//
115+// bReCreateTaskTrayWindow()
116+//
117+BOOL bReCreateTaskTrayWindow(HWND hWnd, UINT message)
118+{
119+ if (message == uTaskbarCreatedMessage) {
120+ if (bDestroyTaskTrayWindow(hWnd)) {
121+ bTaskTray = FALSE;
122+ }
123+ HICON hIcon = NULL;
124+ if ((hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) != NULL) {
125+ if (bCreateTaskTrayWindow(hWnd, hIcon, szTitle)) {
126+ bTaskTray = TRUE;
127+ vStopThreadHookTimer(hWnd);
128+ if (!bStartThreadHookTimer(hWnd)) {
129+ bReportEvent(MSG_THREAD_HOOK_TIMER_RESTART_FAILED, APPLICATION_CATEGORY);
130+ PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
131+ }
132+ bReportEvent(MSG_THREAD_HOOK_TIMER_RESTARTED, APPLICATION_CATEGORY);
133+ return TRUE;
134+ }
135+ else {
136+ if (bDestroyTaskTrayWindow(hWnd)) {
137+ bTaskTray = FALSE;
138+ }
139+ bReportEvent(MSG_TASKTRAY_REGISTER_FAILD, APPLICATION_CATEGORY);
140+ bReportEvent(MSG_RESTART_EVENT, APPLICATION_CATEGORY);
141+ return TRUE;
142+ }
143+ }
144+ else {
145+ return FALSE;
146+ }
147+ }
148+ return TRUE;
149+}
150+
151+//
152+// bDestroyTaskTrayWindow()
153+//
154+BOOL bDestroyTaskTrayWindow(HWND hWnd)
155+{
156+ if (bTaskTray != FALSE) {
157+ NOTIFYICONDATA nIco{};
158+ nIco.cbSize = sizeof(NOTIFYICONDATA);
159+ nIco.hWnd = hWnd;
160+ nIco.uID = NOTIFYICONDATA_ID;
161+ nIco.guidItem = GUID_NULL;
162+ nIco.uFlags = 0;
163+ try {
164+ throw Shell_NotifyIcon(NIM_DELETE, &nIco);
165+ }
166+ catch (BOOL bRet) {
167+ if (bRet) {
168+ bTaskTray = FALSE;
169+ return TRUE;
170+ }
171+ else {
172+ return FALSE;
173+ }
174+ }
175+ catch (...) {
176+ return FALSE;
177+ }
178+ }
179+ return TRUE;
180+}
181+
182+//
183+// bGetTaskTrayWindowRect()
184+//
185+BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect)
186+{
187+ if (bTaskTray != FALSE) {
188+ NOTIFYICONIDENTIFIER nii{};
189+ nii.cbSize = sizeof(NOTIFYICONIDENTIFIER);
190+ nii.hWnd = hWnd;
191+ nii.uID = NOTIFYICONDATA_ID;
192+ nii.guidItem = GUID_NULL;
193+#ifdef _DEBUG
194+ HRESULT hResult = E_FAIL;
195+ if ((hResult = Shell_NotifyIconGetRect(&nii, lpRect)) != S_OK) {
196+ return FALSE;
197+ }
198+ return TRUE;
199+ }
200+#else
201+ try {
202+ throw Shell_NotifyIconGetRect(&nii, lpRect);
203+ }
204+ catch (HRESULT hResult) {
205+ if (hResult != S_OK) {
206+ return FALSE;
207+ }
208+ return TRUE;
209+ }
210+ catch (...) {
211+ PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
212+ return FALSE;
213+ }
214+ }
215+#endif // _DEBUG
216+ return FALSE;
217+}
218+
219+//
220+// WM_TASKTRAYEX
221+// Cls_OnTaskTrayEx()
222+//
223+void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
224+{
225+ if (id != NOTIFYICONDATA_ID) {
226+ return;
227+ }
228+ switch (uMsg) {
229+ case WM_LBUTTONDOWN:
230+ if (bOffChangedFocus) {
231+ Cime->vIMEOpenCloseForced(hWnd, IMECLOSE);
232+ }
233+ [[fallthrough]];
234+ //break;
235+ case WM_RBUTTONDOWN:
236+ bDisplayIMEModeOnCursor = FALSE;
237+ bDoModeDispByMouseBttnUp = FALSE;
238+ bDrawNearCaret = FALSE;
239+
240+ POINT pt{};
241+ GetCursorPos(&pt);
242+ HMENU hMenu = LoadMenu(Resource->hLoad(), MAKEINTRESOURCE(IDR_TT_MENU));
243+ HMENU hSubMenu = GetSubMenu(hMenu, 0);
244+ SetForegroundWindow(hWnd);
245+ APPBARDATA stAppBarData{};
246+ stAppBarData.cbSize = sizeof(APPBARDATA);
247+ stAppBarData.hWnd = hWnd;
248+ SHAppBarMessage(ABM_GETTASKBARPOS, &stAppBarData);
249+ UINT uFlags = 0;
250+ switch (stAppBarData.uEdge) {
251+ case ABE_TOP:
252+ uFlags = TPM_RIGHTALIGN | TPM_TOPALIGN;
253+ if (pt.y < stAppBarData.rc.bottom) pt.y = stAppBarData.rc.bottom;
254+ break;
255+ case ABE_BOTTOM:
256+ uFlags = TPM_RIGHTALIGN | TPM_BOTTOMALIGN;
257+ if (pt.y > stAppBarData.rc.top) pt.y = stAppBarData.rc.top;
258+ break;
259+ case ABE_LEFT:
260+ uFlags = TPM_LEFTALIGN | TPM_BOTTOMALIGN;
261+ if (pt.x < stAppBarData.rc.right) pt.x = stAppBarData.rc.right;
262+ break;
263+ case ABE_RIGHT:
264+ uFlags = TPM_RIGHTALIGN | TPM_BOTTOMALIGN;
265+ if (pt.x > stAppBarData.rc.left) pt.x = stAppBarData.rc.left;
266+ break;
267+ }
268+ TrackPopupMenu(hSubMenu, uFlags, pt.x, pt.y, 0, hWnd, NULL);
269+ break;
270+ }
271+}
272+
273+//
274+// vSettingDialog()
275+//
276+VOID vSettingDialog(HWND hWnd)
277+{
278+ if (hSettingDlg != NULL) {
279+ SetForegroundWindow(hSettingDlg);
280+ return;
281+ }
282+ DialogBox(Resource->hLoad(), MAKEINTRESOURCE(IDD_SETTING), hWnd, SettingDlg);
283+}
284+
285+//
286+// SettingDlg()
287+//
288+static INT_PTR CALLBACK SettingDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
289+{
290+ UNREFERENCED_PARAMETER(lParam);
291+ switch (message) {
292+ case WM_INITDIALOG:
293+ hSettingDlg = hDlg;
294+ {
295+ HICON hIcon = (HICON)LoadImage(Resource->hLoad(), MAKEINTRESOURCE(IDI_SMALL), IMAGE_ICON, 16, 16, 0);
296+ bInitDlgCenter(hDlg, hIcon, (ICC_BAR_CLASSES | ICC_HOTKEY_CLASS));
297+ }
298+ {
299+ TCHAR lpText[MAX_LOADSTRING];
300+ if (LoadString(Resource->hLoad(), IDS_CMBX_LIST01, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
301+ SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)lpText);
302+ if (LoadString(Resource->hLoad(), IDS_CMBX_LIST02, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
303+ SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)lpText);
304+ }
305+ {
306+ bSetCheckDlgButton(hDlg, IDC_CHECK1, Profile->lpstAppRegData->bDisplayIMEModeOnCursor);
307+ bSetCheckDlgButton(hDlg, IDC_CHECK2, Profile->lpstAppRegData->bOffChangedFocus);
308+ bSetCheckDlgButton(hDlg, IDC_CHECK3, Profile->lpstAppRegData->bForceHiragana);
309+ bSetCheckDlgButton(hDlg, IDC_CHECK4, Profile->lpstAppRegData->bDoModeDispByIMEKeyDown);
310+ bSetCheckDlgButton(hDlg, IDC_CHECK5, Profile->lpstAppRegData->bDoModeDispByMouseBttnUp);
311+ bSetCheckDlgButton(hDlg, IDC_CHECK6, Profile->lpstAppRegData->bDoModeDispByCtrlUp);
312+ bSetCheckDlgButton(hDlg, IDC_CHECK7, Profile->lpstAppRegData->bDrawNearCaret);
313+ bSetCheckDlgButton(hDlg, IDC_CHECK8, Profile->lpstAppRegData->bEnableEPHelper);
314+ }
315+ {
316+ vSetTrackbar(hDlg, IDC_SLIDER1, 16, 64, 8, Profile->lpstAppRegData->iCursorSize, 8);
317+ vSetTrackbar(hDlg, IDC_SLIDER2, 8, 64, 8, Profile->lpstAppRegData->iModeSize, 8);
318+ vSetTrackbar(hDlg, IDC_SLIDER3, 100, 800, 70, Profile->lpstAppRegData->dwDisplayModeTime, 70);
319+ vSetTrackbar(hDlg, IDC_SLIDER4, 0, 1000, 100, Profile->lpstAppRegData->dwWaitWaveTime, 100);
320+ if (IsDlgButtonChecked(hDlg, IDC_CHECK3) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0) {
321+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
322+ }
323+ else {
324+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
325+ }
326+ if (IsDlgButtonChecked(hDlg, IDC_CHECK4) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
327+ else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
328+ }
329+ {
330+ if (Profile->lpstAppRegData->bDisplayFocusWindowIME) {
331+ SendDlgItemMessage(hDlg, IDC_COMBO1, CB_SETCURSEL, 0, 0);
332+ }
333+ else {
334+ SendDlgItemMessage(hDlg, IDC_COMBO1, CB_SETCURSEL, 1, 0);
335+ }
336+ }
337+ SetFocus(GetDlgItem(hDlg, IDC_CHECK1));
338+ return (INT_PTR)TRUE;
339+ case WM_HSCROLL:
340+ { // Track Bar
341+ if ((GetDlgItem(hDlg, IDC_SLIDER1) == (HWND)lParam)
342+ || (GetDlgItem(hDlg, IDC_SLIDER2) == (HWND)lParam)
343+ || (GetDlgItem(hDlg, IDC_SLIDER3) == (HWND)lParam)
344+ || (GetDlgItem(hDlg, IDC_SLIDER4) == (HWND)lParam)) {
345+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
346+ }
347+ }
348+ break;
349+ case WM_CTLCOLORDLG:
350+ return (INT_PTR)GetStockObject(WHITE_BRUSH);
351+ case WM_CTLCOLORSTATIC:
352+ case WM_CTLCOLOREDIT:
353+ SetBkMode(((HDC)wParam), TRANSPARENT);
354+ SetTextColor(((HDC)wParam), RGB(0, 0, 0));
355+ return (INT_PTR)GetStockObject(WHITE_BRUSH);
356+ case WM_COMMAND:
357+ switch (LOWORD(wParam)) {
358+ case IDC_CHECK4:
359+ case IDC_CHECK5:
360+ case IDC_CHECK6:
361+ if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK5) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK6) == 0) {
362+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
363+ }
364+ else {
365+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
366+ }
367+ if (IsDlgButtonChecked(hDlg, IDC_CHECK6) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
368+ else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
369+ [[fallthrough]];
370+ case IDC_CHECK1:
371+ case IDC_CHECK2:
372+ case IDC_CHECK3:
373+ case IDC_CHECK7:
374+ case IDC_CHECK8:
375+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
376+ break;
377+ case IDC_COMBO1:
378+ if (HIWORD(wParam) == CBN_SELCHANGE) {
379+ switch (SendDlgItemMessage(hDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0)) {
380+ case 0:
381+ break;
382+ case 1:
383+ if (IsDlgButtonChecked(hDlg, IDC_CHECK2) != 0) {
384+ }
385+ break;
386+ default:
387+ break;
388+ }
389+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), TRUE);
390+ }
391+ break;
392+ case IDC_BUTTON1:
393+ SetFocus(GetDlgItem(hDlg, IDC_CHECK1));
394+ if (IsDlgButtonChecked(hDlg, IDC_CHECK4) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK5) == 0 && IsDlgButtonChecked(hDlg, IDC_CHECK6) == 0) {
395+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), FALSE);
396+ }
397+ else {
398+ EnableWindow(GetDlgItem(hDlg, IDC_SLIDER2), TRUE); EnableWindow(GetDlgItem(hDlg, IDC_SLIDER3), TRUE);
399+ }
400+ if (IsDlgButtonChecked(hDlg, IDC_CHECK6) != 0) EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), TRUE);
401+ else EnableWindow(GetDlgItem(hDlg, IDC_SLIDER4), FALSE);
402+ [[fallthrough]]; // fallthrough is explicit
403+ case IDOK:
404+ Profile->lpstAppRegData->bDisplayIMEModeOnCursor = bGetDlgButtonChecked(hDlg, IDC_CHECK1);
405+ Profile->lpstAppRegData->bOffChangedFocus = bGetDlgButtonChecked(hDlg, IDC_CHECK2);
406+ Profile->lpstAppRegData->bForceHiragana = bGetDlgButtonChecked(hDlg, IDC_CHECK3);
407+ Profile->lpstAppRegData->bDoModeDispByIMEKeyDown = bGetDlgButtonChecked(hDlg, IDC_CHECK4);
408+ Profile->lpstAppRegData->bDoModeDispByMouseBttnUp = bGetDlgButtonChecked(hDlg, IDC_CHECK5);
409+ Profile->lpstAppRegData->bDoModeDispByCtrlUp = bGetDlgButtonChecked(hDlg, IDC_CHECK6);
410+ Profile->lpstAppRegData->bDrawNearCaret = bGetDlgButtonChecked(hDlg, IDC_CHECK7);
411+ Profile->lpstAppRegData->bEnableEPHelper = bGetDlgButtonChecked(hDlg, IDC_CHECK8);
412+ Profile->lpstAppRegData->iCursorSize = (int)dwGetTrackbarPos(hDlg, IDC_SLIDER1);
413+ Profile->lpstAppRegData->iModeSize = (int)dwGetTrackbarPos(hDlg, IDC_SLIDER2);
414+ Profile->lpstAppRegData->dwDisplayModeTime = dwGetTrackbarPos(hDlg, IDC_SLIDER3);
415+ Profile->lpstAppRegData->dwWaitWaveTime = dwGetTrackbarPos(hDlg, IDC_SLIDER4);
416+ switch (SendDlgItemMessage(hDlg, IDC_COMBO1, CB_GETCURSEL, 0, 0)) {
417+ case 0:
418+ Profile->lpstAppRegData->bDisplayFocusWindowIME = TRUE;
419+ break;
420+ case 1:
421+ Profile->lpstAppRegData->bDisplayFocusWindowIME = FALSE;
422+ break;
423+ default:
424+ break;
425+ }
426+ if (Profile != NULL) {
427+ Profile->bSetProfileData();
428+ }
429+ vStopThreadHookTimer(hMainWnd);
430+ if (!bStartThreadHookTimer(hMainWnd)) {
431+ PostMessage(hMainWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
432+ return (INT_PTR)FALSE;
433+ }
434+ if (LOWORD(wParam) == IDC_BUTTON1) {
435+ EnableWindow(GetDlgItem(hDlg, IDC_BUTTON1), FALSE);
436+ return (INT_PTR)FALSE;
437+ }
438+ [[fallthrough]];
439+ case IDCANCEL:
440+ EndDialog(hDlg, LOWORD(wParam));
441+ if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) hSettingDlg = NULL;
442+ return (INT_PTR)TRUE;
443+ }
444+ }
445+ return (INT_PTR)FALSE;
446+}
447+
448+//
449+// bInitDlgCenter()
450+//
451+static BOOL bInitDlgCenter(HWND hDlg, HICON hIcon, DWORD dwICC)
452+{
453+ int cx = GetSystemMetrics(SM_CXSCREEN);
454+ int cy = GetSystemMetrics(SM_CYSCREEN);
455+ RECT rc{};
456+ GetWindowRect(hDlg, (LPRECT)&rc);
457+ rc.right = rc.right - rc.left + 1; rc.bottom = rc.bottom - rc.top + 1;
458+ rc.left = (cx - rc.right) / 2; rc.top = (cy - rc.bottom) / 2;
459+ MoveWindow(hDlg, rc.left, rc.top, rc.right, rc.bottom, TRUE);
460+ SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
461+
462+ INITCOMMONCONTROLSEX stICC{};
463+ stICC.dwSize = sizeof(INITCOMMONCONTROLSEX);
464+ stICC.dwICC = dwICC;
465+ return InitCommonControlsEx(&stICC);
466+}
467+
468+//
469+// bSetCheckDlgButton()
470+//
471+static BOOL bSetCheckDlgButton(HWND hDlg, int iIDButton, BOOL bCheck)
472+{
473+ UINT uCheck = 0;
474+ if (bCheck) uCheck = BST_CHECKED;
475+ else uCheck = BST_UNCHECKED;
476+ if (!CheckDlgButton(hDlg, iIDButton, uCheck)) {
477+ return FALSE;
478+ }
479+ return TRUE;
480+}
481+
482+//
483+// vSetTrackbar()
484+//
485+static VOID vSetTrackbar(HWND hDlg, int iIDTrackbar, int iRangeMin, int iRangeMax, int iTickFreq, int iPos, int iPageSize)
486+{
487+ SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETRANGE, TRUE, MAKELPARAM(iRangeMin, iRangeMax));
488+ SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETTICFREQ, iTickFreq, 0);
489+ SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETPOS, TRUE, iPos);
490+ SendDlgItemMessage(hDlg, iIDTrackbar, TBM_SETPAGESIZE, 0, iPageSize);
491+}
492+
493+//
494+// bGetDlgButtonChecked()
495+//
496+static BOOL bGetDlgButtonChecked(HWND hDlg, int iIDButton)
497+{
498+ if (IsDlgButtonChecked(hDlg, iIDButton) == 0) return FALSE;
499+ else return TRUE;
500+}
501+
502+//
503+// dwGetTrackbarPos()
504+//
505+static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar)
506+{
507+ return (DWORD)SendDlgItemMessage(hDlg, iIDTrackbar, TBM_GETPOS, NULL, NULL);
508+}
509+
510+//
511+// vGetSetProfileData()
512+//
513+VOID vGetSetProfileData()
514+{
515+ bDisplayIMEModeOnCursor = Profile->lpstAppRegData->bDisplayIMEModeOnCursor;
516+ bOffChangedFocus = Profile->lpstAppRegData->bOffChangedFocus;
517+ bDisplayFocusWindowIME = Profile->lpstAppRegData->bDisplayFocusWindowIME;
518+ bDoModeDispByIMEKeyDown = Profile->lpstAppRegData->bDoModeDispByIMEKeyDown;
519+ bDoModeDispByMouseBttnUp = Profile->lpstAppRegData->bDoModeDispByMouseBttnUp;
520+ bDoModeDispByCtrlUp = Profile->lpstAppRegData->bDoModeDispByCtrlUp;
521+ bDrawNearCaret = Profile->lpstAppRegData->bDrawNearCaret;
522+ bEnableEPHelper = Profile->lpstAppRegData->bEnableEPHelper;
523+ bMoveIMEToolbar = Profile->lpstAppRegData->bMoveIMEToolbar;
524+ bIMEModeForced = Profile->lpstAppRegData->bIMEModeForced;
525+}
526+
527+/* = EOF = */
--- /dev/null
+++ b/FlushMouse/TaskTray.h
@@ -0,0 +1,37 @@
1+//
2+// TaskTray.h
3+// Copyright (C) 2022 JeffyTS
4+//
5+// No. Date Name Reason & Document
6+// -------+-----------+-----------+-------------------------------------------- -
7+// #0000 2022/03/03 JeffyTS New edit.
8+// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.h
9+
10+//
11+// Include
12+//
13+#pragma once
14+#include "pch.h"
15+
16+//
17+// Global Data
18+//
19+extern HWND hAboutDlg;
20+extern HWND hSettingDlg;
21+extern BOOL bIMEInConverting;
22+
23+//
24+// Global Prototype Define
25+//
26+extern BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitile);
27+extern BOOL bReCreateTaskTrayWindow(HWND hWnd, UINT message);
28+extern BOOL bDestroyTaskTrayWindow(HWND hWnd);
29+extern BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect);
30+extern void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg);
31+extern void vMessageBox(HWND hWnd, UINT uID, UINT uType);
32+extern VOID vAboutDialog(HWND hWnd);
33+extern VOID vSettingDialog(HWND hWnd);
34+extern VOID vGetSetProfileData();
35+
36+
37+/* = EOF = */
\ No newline at end of file
--- a/FlushMouse32/FlushMouse32.cpp
+++ b/FlushMouse32/FlushMouse32.cpp
@@ -1,9 +1,10 @@
1-// FlushMouse32.cpp
1+//
2+// FlushMouse32.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/04/06 JeffyTS New edit.
7+// #0000 2022/04/06 JeffyTS New edit.
78 //
89
910 //
@@ -45,10 +46,9 @@ static UINT_PTR uCheckProcTimer = NULL;
4546 //
4647 // Local Data
4748 //
48-static TCHAR szTitle[MAX_LOADSTRING]{}; // タイトル バーのテキスト
49-//static TCHAR szWindowClass[]{ CLASS_FLUSHMOUSE32 }; // メイン ウィンドウ クラス名
50-static HINSTANCE hInst = NULL; // 現在のインターフェイス
51-static HWND hParentWnd = NULL; // 親のWindow Handle
49+static TCHAR szTitle[MAX_LOADSTRING]{};
50+static HINSTANCE hInst = NULL;
51+static HWND hParentWnd = NULL;
5252
5353 //
5454 // Global Prototype Define
@@ -68,6 +68,7 @@ static void Cls_OnDestroy(HWND hWnd);
6868 // Sub
6969 static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
7070 static BOOL bReportEvent(DWORD dwEventID, WORD wCategory);
71+static BOOL bCreateProcess(LPCTSTR lpszExecName);
7172 static void vMessageBox(HWND hWnd, UINT uID, UINT uType);
7273
7374 //
@@ -177,7 +178,7 @@ static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
177178 UNREFERENCED_PARAMETER(nCmdShow);
178179 #define WINDOWSTYLE WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL // | WS_VISIBLE // WS_MINIMIZE | WS_SYSMENU
179180 hInst = hInstance; // グローバル変数にインスタンス ハンドルを格納する
180- HWND hWnd = NULL; // メインウィンドウのハンドル
181+ HWND hWnd = NULL; // メインウィンドウのハンドル
181182 hWnd = CreateWindowEx(
182183 WS_DISABLED, // Disabled Window
183184 CLASS_FLUSHMOUSE32, // RegisterClass()呼び出しを参照
@@ -223,7 +224,7 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
223224 return FALSE;
224225 }
225226
226- BOOL bBool = FALSE;
227+ BOOL bBool = FALSE;
227228 if (SetUserObjectInformation(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION, &bBool, sizeof(BOOL)) != FALSE) {
228229 // Set Timer for Proc
229230 if (uCheckProcTimer == NULL) {
@@ -281,14 +282,13 @@ static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DW
281282 }
282283 catch (BOOL bRet) {
283284 if (!bRet) {
284- return;
285285 }
286286 }
287287 catch (...) {
288- return;
289288 }
290289 bReportEvent(MSG_DETECT_FLUSHMOUSE_STOP, APPLICATION32_CATEGORY);
291- bReportEvent(MSG_RESTART_EVENT, APPLICATION32_CATEGORY);
290+ bCreateProcess(FLUSHMOUSE_EXE);
291+ bReportEvent(MSG_RESTART_EVENT, APPLICATION32_CATEGORY);
292292 PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
293293 }
294294 }
@@ -300,7 +300,7 @@ static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DW
300300 //
301301 static BOOL bReportEvent(DWORD dwEventID, WORD wCategory)
302302 {
303- BOOL bRet = FALSE;
303+ BOOL bRet = FALSE;
304304 HANDLE hEvent = RegisterEventSource(NULL, _T("FlushMouse"));
305305 if (hEvent != NULL) {
306306 if (ReportEvent(hEvent, (0x0000000c & (dwEventID >> 28)), wCategory, dwEventID, NULL, 0, 0, NULL, NULL) != 0) {
@@ -316,6 +316,30 @@ static BOOL bReportEvent(DWORD dwEventID, WORD wCategory)
316316 }
317317
318318 //
319+// bCreateProcess()
320+//
321+static BOOL bCreateProcess(LPCTSTR lpszExecName)
322+{
323+ BOOL bRet = FALSE;
324+ DWORD dwSize = 0;
325+ dwSize = ExpandEnvironmentStrings(lpszExecName, NULL, 0);
326+ LPTSTR lpszBuffer = new TCHAR[dwSize];
327+ if (lpszBuffer) {
328+ ZeroMemory(lpszBuffer, dwSize);
329+ dwSize = ExpandEnvironmentStrings(lpszExecName, lpszBuffer, dwSize);
330+ PROCESS_INFORMATION ProcessInfomation{};
331+ STARTUPINFO StartupInfo{}; StartupInfo.cb = sizeof(STARTUPINFO);
332+ if (CreateProcess(lpszBuffer, NULL, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &StartupInfo, &ProcessInfomation) != FALSE) {
333+ CloseHandle(ProcessInfomation.hProcess);
334+ CloseHandle(ProcessInfomation.hThread);
335+ bRet = TRUE;
336+ }
337+ delete[] lpszBuffer;
338+ }
339+ return bRet;
340+}
341+
342+//
319343 // vMessageBox()
320344 //
321345 static void vMessageBox(HWND hWnd, UINT uID, UINT uType)
--- a/FlushMouse32/FlushMouse32.h
+++ b/FlushMouse32/FlushMouse32.h
@@ -1,9 +1,10 @@
1-// FlushMouse32.h
1+//
2+// FlushMouse32.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/04/06 JeffyTS New edit.
7+// #0000 2022/04/06 JeffyTS New edit.
78 //
89
910 //
--- a/FlushMouseCursor/FlushMouseCursor.cpp
+++ b/FlushMouseCursor/FlushMouseCursor.cpp
@@ -1,4 +1,5 @@
1-// FlushMouseCursor.cpp
1+//
2+// FlushMouseCursor.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
--- a/FlushMouseCursor/FlushMouseCursor.h
+++ b/FlushMouseCursor/FlushMouseCursor.h
@@ -1,9 +1,10 @@
1-// FlushMouseCursor.h
1+//
2+// FlushMouseCursor.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/17 JeffyTS New edit.
7+// #0000 2022/03/17 JeffyTS New edit.
78 //
89
910 //
--- a/FlushMouseDLL/EventlogData.h
+++ b/FlushMouseDLL/EventlogData.h
@@ -1,3 +1,4 @@
1+//
12 // Eventlog.mc
23 // Copyright (C) 2023 JeffyTS
34 //
@@ -108,13 +109,13 @@
108109 #define POWERNOTIFICATION_CATEGORY ((DWORD)0x00000010L)
109110
110111 //
111-// MessageId: TASKSCHDULER_CATEGORY
112+// MessageId: TASKSCHEDULER_CATEGORY
112113 //
113114 // MessageText:
114115 //
115-// TaskSheduler Events
116+// TaskScheduler Events
116117 //
117-#define TASKSCHDULER_CATEGORY ((DWORD)0x00000011L)
118+#define TASKSCHEDULER_CATEGORY ((DWORD)0x00000011L)
118119
119120 //
120121 // Message definitions.
@@ -259,7 +260,7 @@
259260 //
260261 // MessageText:
261262 //
262-// Resumeed from Susped (APM).
263+// Resumed from Suspend (APM).
263264 //
264265 #define MSG_PBT_APMRESUMESUSPEND ((DWORD)0x40000102L)
265266
--- a/FlushMouseDLL/EventlogData.mc
+++ b/FlushMouseDLL/EventlogData.mc
@@ -1,3 +1,4 @@
1+;//
12 ;// Eventlog.mc
23 ;// Copyright (C) 2023 JeffyTS
34 ;//
@@ -89,13 +90,13 @@ PowerNotification Events
8990 .
9091
9192 MessageId=0x11
92-SymbolicName=TASKSCHDULER_CATEGORY
93+SymbolicName=TASKSCHEDULER_CATEGORY
9394 Language=English
94-TaskSheduler Events
95+TaskScheduler Events
9596 .
9697
9798 Language=Japanese
98-TaskSheduler Events
99+TaskScheduler Events
99100 .
100101
101102
@@ -291,11 +292,11 @@ Severity=Informational
291292 Facility=Application
292293 SymbolicName=MSG_PBT_APMRESUMESUSPEND
293294 Language=English
294-Resumeed from Susped (APM).
295+Resumed from Suspend (APM).
295296 .
296297
297298 Language=Japanese
298-Resumeed from Susped (APM).
299+Resumed from Suspend (APM).
299300 .
300301
301302 MessageId=0x0103
--- a/FlushMouseDLL/EventlogDll.cpp
+++ b/FlushMouseDLL/EventlogDll.cpp
@@ -18,7 +18,7 @@
1818 //
1919 DLLEXPORT BOOL __stdcall bReportEvent(DWORD dwEventID, WORD wCategory)
2020 {
21- BOOL bRet = FALSE;
21+ BOOL bRet = FALSE;
2222 HANDLE hEvent = RegisterEventSource(NULL, _T("FlushMouse"));
2323 if (hEvent != NULL) {
2424 if (ReportEvent(hEvent, (0x0000000c & (dwEventID >> 28)), wCategory, dwEventID, NULL, 0, 0, NULL, NULL) != 0) {
--- a/FlushMouseDLL/FlushMouseDll.cpp
+++ b/FlushMouseDLL/FlushMouseDll.cpp
@@ -1,9 +1,10 @@
1-// FlushMouseDll.cpp : DLL アプリケーションのエントリ ポイントを定義します。
1+//
2+// FlushMouseDll.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/02/12 JeffyTS New edit.
7+// #0000 2022/02/12 JeffyTS New edit.
78 //
89
910 //
--- a/FlushMouseDLL/FlushMouseDll.h
+++ b/FlushMouseDLL/FlushMouseDll.h
@@ -1,4 +1,5 @@
1-// FlushMouseDll.h
1+//
2+// FlushMouseDll.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
--- a/FlushMouseDLL/GlobalHookDll.cpp
+++ b/FlushMouseDLL/GlobalHookDll.cpp
@@ -1,4 +1,5 @@
1-// GlobalHookDll.cpp
1+//
2+// GlobalHookDll.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
@@ -77,7 +78,7 @@ DLLEXPORT BOOL __stdcall bGlobalHookSet(HWND hWnd)
7778 //
7879 DLLEXPORT BOOL __stdcall bGlobalHookUnset()
7980 {
80- BOOL bRet = FALSE;
81+ BOOL bRet = FALSE;
8182 if (CSharedMem != NULL) {
8283 if ((lpDatGlobal = (LPGLOBAL_SHAREDMEM)CSharedMem->lpvSharedMemoryRead()) != NULL) {
8384 if (lpDatGlobal->hWnd) {
--- a/FlushMouseDLL/GlobalHookDll.h
+++ b/FlushMouseDLL/GlobalHookDll.h
@@ -1,4 +1,5 @@
1-// GlobalHookDll.h
1+//
2+// GlobalHookDll.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
--- a/FlushMouseDLL/KeyboardHookDll.cpp
+++ b/FlushMouseDLL/KeyboardHookDll.cpp
@@ -1,9 +1,10 @@
1-// KeyboardHookDll.cpp
1+//
2+// KeyboardHookDll.cpp
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/02/12 JeffyTS New edit.
7+// #0000 2022/02/12 JeffyTS New edit.
78 //
89
910 //
@@ -26,12 +27,12 @@
2627 #pragma comment(linker, "/SECTION:FLUSHMOUSEDLL_SEG,RWS")
2728 #pragma data_seg("FLUSHMOUSEDLL_SEG")
2829 static BOOL bOnlyCtrlLL = FALSE;
29-static DWORD dwPreviousVKLL = 0;
30+static DWORD dwPreviousVKLL = 0;
3031 static HWND hWndKBParentLL = NULL;
3132 static LPKEYBOARDLL_SHAREDMEM lpDatKeyboardLL = NULL;
3233 static BOOL bEnableEPHelperLL = FALSE;
3334 static BOOL bStartConvertingLL = FALSE;
34-static CSharedMemory *CSharedMemLL = NULL;
35+static CSharedMemory *CSharedMemLL = NULL;
3536 #pragma data_seg()
3637
3738 //
@@ -78,7 +79,7 @@ DLLEXPORT BOOL __stdcall bKeyboardHookLLSet(HWND hWnd)
7879 //
7980 DLLEXPORT BOOL __stdcall bKeyboardHookLLUnset()
8081 {
81- BOOL bRet = FALSE;
82+ BOOL bRet = FALSE;
8283 if (CSharedMemLL != NULL) {
8384 if ((lpDatKeyboardLL = (LPKEYBOARDLL_SHAREDMEM)CSharedMemLL->lpvSharedMemoryRead()) != NULL) {
8485 if (lpDatKeyboardLL->hHook) {
@@ -103,7 +104,7 @@ DLLEXPORT BOOL __stdcall bKeyboardHookLLUnset()
103104 //
104105 DLLEXPORT BOOL __stdcall bSetEnableEPHelperLL64(BOOL bEPHelper)
105106 {
106- BOOL bRet = FALSE;
107+ BOOL bRet = FALSE;
107108 bEnableEPHelperLL = bEPHelper;
108109 if (CSharedMemLL != NULL) {
109110 if ((lpDatKeyboardLL = (LPKEYBOARDLL_SHAREDMEM)CSharedMemLL->lpvSharedMemoryRead()) != NULL) {
@@ -362,23 +363,8 @@ static BOOL bKeyboardHookLLProcSub()
362363 }
363364 }
364365 hWndKBParentLL = lpDatKeyboardLL->hWnd;
365- bEnableEPHelperLL = lpDatKeyboardLL->bEnableEPHelper; // @@@ for Explorer Patcher Simple Window Switcher
366+ bEnableEPHelperLL = lpDatKeyboardLL->bEnableEPHelper;
366367 return TRUE;
367- /*
368- if ((hWndKBParentLL == NULL) || (lpDatKeyboardLL == NULL)) {
369- if (lpDatKeyboardLL == NULL) {
370- if ((lpDatKeyboardLL = (LPKEYBOARDLL_SHAREDMEM)lpvSharedMemoryOpen(KEYBOARDHOOKLLMEM, sizeof(KEYBOARDLL_SHAREDMEM))) == NULL) {
371- return FALSE;
372- }
373- }
374- if (lpDatKeyboardLL->hWnd == NULL) {
375- return FALSE;
376- }
377- hWndKBParentLL = lpDatKeyboardLL->hWnd;
378- bEnableEPHelperLL = lpDatKeyboardLL->bEnableEPHelper; // @@@ for Explorer Patcher Simple Window Switcher
379- }
380- return TRUE;
381- */
382368 }
383369
384370 /* = EOF = */
\ No newline at end of file
--- a/FlushMouseDLL/KeyboardHookDll.h
+++ b/FlushMouseDLL/KeyboardHookDll.h
@@ -1,4 +1,5 @@
1-// KeyboardHookDll.h
1+//
2+// KeyboardHookDll.h
23 // Copyright (C) 2022 JeffyTS
34 //
45 // No. Date Name Reason & Document
Binary files a/FlushMouseDLL/MSG00409.bin and b/FlushMouseDLL/MSG00409.bin differ
Binary files a/FlushMouseDLL/MSG00411.bin and b/FlushMouseDLL/MSG00411.bin differ
--- a/FlushMouseDLL32/MouseHookDll32.cpp
+++ b/FlushMouseDLL32/MouseHookDll32.cpp
@@ -66,7 +66,7 @@ DLLEXPORT BOOL __stdcall bMouseHookSet32(HWND hWnd)
6666 //
6767 DLLEXPORT BOOL __stdcall bMouseHookUnset32()
6868 {
69- BOOL bRet = FALSE;
69+ BOOL bRet = FALSE;
7070 if (CSharedMem != NULL) {
7171 if ((lpDatMouse = (LPMOUSE_SHAREDMEM32)CSharedMem->lpvSharedMemoryRead()) != NULL) {
7272 if (lpDatMouse->hHook) {
Binary files a/FlushMouse_x64.msi and b/FlushMouse_x64.msi differ
--- /dev/null
+++ b/OSDN Wiki/README.md
@@ -0,0 +1,16 @@
1+
2+# FlushMouse ![Icon](https://osdn.net/users/jeffyts/pf/FlushMouse/wiki/FrontPage/thumb/48x48/FlushMouse.png)
3+
4+**タスクトレイに常駐して、マウスカーソルへIMEモードの表示をするユーティリティです**
5+
6+**FlushMouse is a software developed by JeffyTS. It is a mouse gesture tool that allows you to perform various operations by drawing gestures with your mouse. (by Bing)**
7+
8+
9+
10+
11+使い方については [OSDN/FlushMouse](https://osdn.net/users/jeffyts/pf/FlushMouse/wiki/FrontPage "https://osdn.net/users/JeffyTS/pf/FlushMouse/wiki/FrontPage)") を参照してください (どちらにも同じソースとバイナリが置いてあります)
12+
13+![Cursors](https://osdn.net/users/jeffyts/pf/FlushMouse/wiki/FrontPage/thumb/230x181/Cursors.png)
14+
15+![SettingDialog](https://osdn.net/users/jeffyts/pf/FlushMouse/wiki/FrontPage/thumb/572x645/SettingDlg.png)
16+
--- a/OSDN Wiki/osdn.txt
+++ b/OSDN Wiki/osdn.txt
@@ -5,12 +5,11 @@
55 ||[[Thumb(FlushMouse.png, size=48x48)]]||'''[[ProjectDescription]](タスクトレイに常駐して、マウスカーソルへIMEモードの表示をするユーティリティです)[[BR]]FlushMouse is a software developed by JeffyTS . It is a mouse gesture tool that allows you to perform various operations by drawing gestures with your mouse . (by Bing)'''||
66
77 [[BR]]
8-2023/06/28[[BR]]
9-   '''Version 1.1.0.3 をリリースしました'''[[BR]]
8+2023/07/05[[BR]]
9+   '''Version 1.1.1.7 をリリースしました'''[[BR]]
1010 [[BR]]
1111 (主な変更点)[[BR]]
12- * キャレット位置の取得方法を見直しました。これで、Chromium Edge や Chrome など多数のアプリでキャレットの左側に IME のモードを表示できるようになりました[[BR]]
13- * その他、細かい処理の見直しや、バグの修正をしました[[BR]]
12+ * 細かい処理の見直しや、バグの修正をしました[[BR]]
1413 [[BR]]
1514 * IMEモードの表示の色指定でαチャネルが有効になるようにしてあります(設定画面は作成していません。レジストリを編集できる方は好みの色にしてみてください (ただし、レジストリの編集は十分注意して行ってください)[[BR]]
1615 * HKEY_CURRENT_USER\Software\JeffyTS\FlushMouse の NearDrawCaretColor と NearDrawMouseColor です。上位バイトから、α B G R の順です[[BR]]
--- a/version.h
+++ b/version.h
@@ -1,18 +1,19 @@
1+//
12 // version.h
23 // Copyright (C) 2023 JeffyTS
34 //
45 // No. Date Name Reason & Document
56 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2023/03/17 JeffyTS New edit.
7+// #0000 2023/03/17 JeffyTS New edit.
78 //
89
910 #define MAJOR_VERSION 1
1011 #define MINOR_VERSION 1
11-#define BUILD_VERSION 0
12-#define REVISON_VERSION 3
12+#define BUILD_VERSION 1
13+#define REVISON_VERSION 7
1314
14-#define FILE_VERSION_STRING VALUE "FileVersion", "1.1.0.3"
15-#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "1.1.0.3"
15+#define FILE_VERSION_STRING VALUE "FileVersion", "1.1.1.7"
16+#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "1.1.1.7"
1617
1718 #define FILE_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION
1819 #define PRODUCT_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION
--- a/version.wxi
+++ b/version.wxi
@@ -1,5 +1,6 @@
11 <Include>
22 <!-- for wix Setup Project -->
3- <?define Version = "1.0.2.6" ?>
3+ <!-- Copyright (C) 2023 JeffyTS -->
4+ <?define Version = "1.1.1.7" ?>
45 </Include>
56