• 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évision1c66eb5611cfe0907ecf845b7af608d48fc91fc7 (tree)
l'heure2023-06-13 14:15:26
AuteurJeffyTS <jeffyts@outl...>
CommiterJeffyTS

Message de Log

1.0.0.1

Change Summary

Modification

--- a/FlushMouse.sln
+++ b/FlushMouse.sln
@@ -20,17 +20,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FlushMouseDLL32", "FlushMou
2020 EndProject
2121 Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SetupProject", "SetupProject\SetupProject.wixproj", "{40614F11-A07B-42AB-822E-FAC73CC85CB0}"
2222 EndProject
23-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{352B420D-E55A-4196-9597-D394D0DA2519}"
24- ProjectSection(SolutionItems) = preProject
25- Solution.props = Solution.props
26- EndProjectSection
27-EndProject
2823 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MiscLIB", "MiscLIB\MiscLIB.vcxproj", "{CCAF431F-CE8E-4879-9B1F-3F1DF4AC2269}"
2924 EndProject
3025 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MiscLIB32", "MiscLIB32\MiscLIB32.vcxproj", "{3D3F632C-75BB-4830-AA8E-0871C6AA1A72}"
3126 EndProject
3227 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ソリューション項目", "ソリューション項目", "{4DA8FAF2-6A3D-41B4-B811-0F39BFA7CAA5}"
3328 ProjectSection(SolutionItems) = preProject
29+ FlushMouse_x64.msi = FlushMouse_x64.msi
3430 version.h = version.h
3531 version.wxi = version.wxi
3632 EndProjectSection
--- a/FlushMouse/CommonDef.h
+++ b/FlushMouse/CommonDef.h
@@ -11,7 +11,6 @@
1111 //
1212 #pragma once
1313 #include "pch.h"
14-#include "..\..\DEFS\types.h"
1514
1615 //
1716 // Define
@@ -20,7 +19,7 @@
2019
2120 // Window Class
2221 #define CLASS_FLUSHMOUSE L"FlushMouse-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}"
23-#define CLASS_FLUSHMOUSE32 L"FlushMouse32-{07C82AC3-DF75-469D-8443-91E6274A2422}"
22+#define CLASS_FLUSHMOUSE32 L"FlushMouse32-{E598B54C-A36A-4CDF-BC77-7082CEEDAA46}"
2423
2524 // for IME
2625 #define IMC_GETCONVERSIONMODE 0x0001
@@ -30,6 +29,18 @@
3029 #define IMC_GETOPENSTATUS 0x0005
3130 #define IMC_SETOPENSTATUS 0x0006
3231
32+// for KB
33+#define KB_MASK 0xffff0000
34+#define KB_JP 0x04110000
35+#define KB_US 0x04090000
36+#define LANG_MASK 0x0000ffff
37+#define LANG_IME 0x00000411
38+#define LANG_ENG 0x00000409
39+#define JP_IME (HKL)(KB_JP | LANG_IME)
40+#define JP_ENG (HKL)(KB_JP | LANG_ENG)
41+#define US_IME (HKL)(KB_US | LANG_IME)
42+#define US_ENG (HKL)(KB_US | LANG_ENG)
43+
3344 // for Shell_NotifyIcon
3445 #define NOTIFYICONDATA_ID 0x684B9604
3546
--- a/FlushMouse/Cursor.cpp
+++ b/FlushMouse/Cursor.cpp
@@ -190,23 +190,21 @@ BOOL CALLBACK CIME::bEnumChildProcActivateIME(HWND hWnd, LPARAM lParam)
190190 {
191191 UNREFERENCED_PARAMETER(lParam);
192192
193- BOOL bRet = FALSE;
194193 HWND hIMWnd = ImmGetDefaultIMEWnd(hWnd);
195194 if (hIMWnd != NULL) {
196195 SendMessage(hIMWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
197196 LPTSTR lpszBuffer = new TCHAR[_MAX_PATH];
198- ZeroMemory(lpszBuffer, _MAX_PATH);
197+ ZeroMemory(lpszBuffer, (sizeof(TCHAR) * _MAX_PATH));
199198 if (GetClassName(hIMWnd, lpszBuffer, _MAX_PATH) != 0) {
200199 HWND hIMEWnd = FindWindow(lpszBuffer, NULL);
201200 if (hIMEWnd != NULL) {
202201 SendMessage(hIMEWnd, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)NULL);
203-
204- bRet = TRUE;
202+ if (lpszBuffer != NULL) delete[] lpszBuffer;
203+ return TRUE;
205204 }
206205 }
207206 if (lpszBuffer != NULL) delete[] lpszBuffer;
208207 }
209- //return bRet;
210208 return TRUE;
211209 }
212210
@@ -335,7 +333,6 @@ BOOL CIME::bGetVirtualDesktopSize()
335333 return bRet;
336334 }
337335
338-
339336 //
340337 // bGetVirtualDesktopSizeEnumProc()
341338 //
@@ -395,6 +392,48 @@ BOOL CIME::bIsNewIME()
395392 }
396393
397394 //
395+// dGetInputLocale()
396+//
397+DWORD CIME::dwGetInputLocale()
398+{
399+#define SUBKEY _T("SOFTWARE\\Microsoft\\Input\\Locales")
400+#define VALUE _T("InputLocale")
401+ DWORD dwInputLocale = 0;
402+ CRegistry* CReg = new CRegistry;
403+ if (CReg) {
404+ if (!CReg->bReadSystemRegValueDWORD(HKEY_LOCAL_MACHINE, SUBKEY, VALUE, &dwInputLocale)) {
405+ }
406+ delete CReg;
407+ }
408+ return (dwInputLocale & 0x0000ffff);
409+#undef SUBKEY
410+#undef VALUE
411+}
412+
413+//
414+// hklGetInputLocale()
415+//
416+HKL CIME::hklGetInputLocale(HWND hWndObserved)
417+{
418+
419+ DWORD dwProcessID = 0;
420+ DWORD dwThreadID = 0;
421+ HKL hkl = NULL;
422+ DWORD dwInputLocale = 0;
423+ if ((dwThreadID = GetWindowThreadProcessId(hWndObserved, &dwProcessID)) != 0) {
424+ if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) {
425+ int iKeyboardType = GetKeyboardType(1);
426+ if ((iKeyboardType != 2) || (hkl != JP_IME)) hkl = US_ENG;
427+ hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK));
428+ return hkl;
429+ }
430+ }
431+ return (HKL)0;
432+#undef SUBKEY
433+#undef VALUE
434+}
435+
436+//S
398437 // class CCursor
399438 //
400439 CCursor::CCursor()
@@ -939,23 +978,27 @@ BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
939978 int iCursorSizeX = 0, iCursorSizeY = 0, iCaretSizeX = 0, iCaretSizeY = 0;
940979 DWORD dwIMEMode = Cime->dwIMEMode(lpstCursorData->hWndObserved, lpstCursorData->bForceHiragana);
941980 int iCursor = 0;
942- if (dwIMEMode != IMEOFF) {
943- while (dwIMEMode != lpstCursorData->lpstFlushMouseCursor[iCursor].dwIMEMode) {
944- ++iCursor;
981+ while (dwIMEMode != lpstCursorData->lpstFlushMouseCursor[iCursor].dwIMEMode) {
982+ ++iCursor;
983+ if (lpstCursorData->lpstFlushMouseCursor[iCursor].dwIMEMode == (DWORD)(-1)) {
984+ iCursor = 0; dwIMEMode = IMEOFF;
985+ break;
945986 }
946- CursorWindow->vSetModeString(stIMECursorData.lpstFlushMouseCursor[iCursor].szMode);
947987 }
988+ CursorWindow->vSetModeString(stIMECursorData.lpstFlushMouseCursor[iCursor].szMode);
948989 if (lpstCursorData->bDrawNearCaret != FALSE) {
949990 POINT pt{};
950991 HWND hWnd = GetForegroundWindow();
951992 if (bCalcDispModeCaretRect(hWnd, lpstCursorData->iModeSize, lpstCursorData->iModeSize, &rcCaret, &pt)) {
952993 hWnd = WindowFromPoint(pt);
953994 DWORD dwIMEModeCaret = dwIMEMode;
954- int iCaret = iCursor;
955- if (hWnd != lpstCursorData->hWndObserved) {
956- dwIMEModeCaret = Cime->dwIMEMode(hWnd, lpstCursorData->bForceHiragana);
957- while (dwIMEModeCaret != lpstCursorData->lpstFlushMouseCursor[iCaret].dwIMEMode) {
958- ++iCaret;
995+ int iCaret = 0;
996+ dwIMEModeCaret = Cime->dwIMEMode(hWnd, lpstCursorData->bForceHiragana);
997+ while (dwIMEModeCaret != lpstCursorData->lpstFlushMouseCursor[iCaret].dwIMEMode) {
998+ ++iCaret;
999+ if (lpstCursorData->lpstFlushMouseCursor[iCaret].dwIMEMode == (DWORD)(-1)) {
1000+ iCaret = 0; dwIMEModeCaret = IMEOFF;
1001+ break;
9591002 }
9601003 }
9611004 if ((rcCaret.left != 0) || (rcCaret.top != 0) || (rcCaret.right != 0) || (rcCaret.bottom != 0)) {
--- a/FlushMouse/Cursor.h
+++ b/FlushMouse/Cursor.h
@@ -169,6 +169,8 @@ public:
169169 BOOL bMoveIMEToolbar();
170170 BOOL bGetVirtualDesktopSize();
171171 BOOL bIsNewIME();
172+ DWORD dwGetInputLocale();
173+ HKL hklGetInputLocale(HWND hWndObserved);
172174
173175 private:
174176 BOOL bExistIMEToolbar();
@@ -282,7 +284,7 @@ private:
282284 { IMEHIDE, _T(""), {OCR_NORMAL, IDC_HIDE_ARROW, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnArrow.cur")},
283285 {OCR_HAND, IDC_HIDE_HAND, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnHand.cur")},
284286 {OCR_IBEAM, IDC_HIDE_IBEAM, FALSE, _T(""), _T("%APPDATA%\\JeffyTS\\FlushMouse\\ImeHideOnIBeam.cur")}},
285- { (UINT)(-1), _T(""), {0, 0, FALSE, _T(""), _T("")}, // Terminater
287+ { (DWORD)(-1), _T(""), {0, 0, FALSE, _T(""), _T("")}, // Terminater
286288 {0, 0, FALSE, _T(""), _T("")}, // Terminater
287289 {0, 0, FALSE, _T(""), _T("")} } // Terminater
288290 };
--- a/FlushMouse/FlushMouse.cpp
+++ b/FlushMouse/FlushMouse.cpp
@@ -21,6 +21,7 @@
2121 #include "..\version.h"
2222 #include "FlushMouseLIB.h"
2323 #include "Resource.h"
24+#include "..\FlushMouseDLL\EventlogDll.h"
2425
2526 #if defined _DEBUG
2627 #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
@@ -55,7 +56,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
5556 //
5657 // Local Prototype Define
5758 //
58-static INT_PTR CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
59+static BOOL bSetHeapInformation();
60+static INT_PTR CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
5961
6062 //
6163 // 関数: wWinMain()
@@ -68,6 +70,43 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
6870 #if defined _DEBUG
6971 _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
7072 #endif
73+
74+ HANDLE hHandle = GetCurrentProcess();
75+ if (!SetPriorityClass(hHandle, NORMAL_PRIORITY_CLASS)) {
76+ return (-1);
77+ }
78+
79+ if (!bSetHeapInformation()) return (-1);
80+
81+ if (*lpCmdLine == _T('\0')) {
82+ // NOP
83+ }
84+ else {
85+ int iRet = 0;
86+ if ((iRet = CompareStringOrdinal(lpCmdLine, -1, L"/quit", -1, TRUE)) != 0) {
87+ if (iRet == CSTR_EQUAL) {
88+ bReportEvent(MSG_DONE_FLUSHMOUSE, APPLICATION_CATEGORY); // Eventlog
89+ HWND hWnd = NULL;
90+ if ((hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL)) != NULL) { // 先に起動されているウィンドウハンドルを探す
91+ SetFocus(GetLastActivePopup(hWnd)); // 先に起動されているウィンドウへフォーカスを与える
92+ PostMessage(hWnd, WM_DESTROY, NULL, NULL); // 先に起動されているウィンドウを終了させる
93+ for (int i = 3; i > 0; i--) {
94+ Sleep(500); // 終了を3回待つ
95+ if ((hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL)) != NULL) {
96+ SetFocus(GetLastActivePopup(hWnd)); // 先に起動されているウィンドウへフォーカスを与える
97+ PostMessage(hWnd, WM_DESTROY, NULL, NULL); // 先に起動されているウィンドウを終了させる
98+ if (i == 1) {
99+ return (-1); // 終了していない場合はエラー終了
100+ }
101+ }
102+ else return 0;
103+ }
104+ }
105+ }
106+ }
107+ if (hHandle != NULL) CloseHandle(hHandle);
108+ return 0;
109+ }
71110
72111 #define RESOURCEFILE _T("FlushMouse.exe")
73112 // Load Resource
@@ -86,17 +125,53 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
86125 DispatchMessage(&msg);
87126 }
88127 }
128+ if (Resource) delete Resource;
89129 return (int)msg.wParam;
90130 }
91131
132+//
133+// bSetHeapInformation()
134+//
135+BOOL bSetHeapInformation()
136+{
137+ HANDLE hHeap = NULL;
138+ if ((hHeap = GetProcessHeap()) != NULL) {
139+ ULONG HeapInformation = 2;
140+ if (!HeapSetInformation(hHeap, HeapCompatibilityInformation, &HeapInformation, sizeof(ULONG))) {
141+ _Post_equals_last_error_ DWORD err = GetLastError();
142+ if (err != ERROR_INVALID_PARAMETER) { // 87 (0x57)
143+ return FALSE;
144+ }
145+ }
146+ return TRUE;
147+ }
148+ return FALSE;
149+}
150+
92151 //
93152 // vMessageBox()
94153 //
95154 void vMessageBox(HWND hWnd, UINT uID, UINT uType)
96155 {
97156 TCHAR lpText[MAX_LOADSTRING];
98- if (LoadString(Resource->hLoad(), uID, lpText, MAX_LOADSTRING) != 0) {
99- MessageBox(hWnd, lpText, szTitle, uType);
157+ try {
158+ throw LoadString(Resource->hLoad(), uID, lpText, MAX_LOADSTRING);
159+ }
160+ catch (int i) {
161+ if (i != 0) {
162+ try {
163+ throw MessageBox(hWnd, lpText, szTitle, uType);
164+ }
165+ catch (int) {
166+ return;
167+ }
168+ catch (...) {
169+ return; // error
170+ }
171+ }
172+ }
173+ catch (...) {
174+ return; // error
100175 }
101176 }
102177
@@ -135,11 +210,15 @@ static INT_PTR CALLBACK AboutDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM
135210 HICON hIcon = NULL;
136211 hIcon = (HICON)LoadImage(Resource->hLoad(), MAKEINTRESOURCE(IDI_SMALL), IMAGE_ICON, 16, 16, 0);
137212 SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); // Iconの設定
138- LPTSTR lpszVersion = new TCHAR[128];
139- ZeroMemory(lpszVersion, (sizeof(TCHAR) * 128));
140- _sntprintf_s(lpszVersion, 128, _TRUNCATE, _T("%d.%d.%d.%d"), MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION);
141- SetDlgItemText(hDlg, IDC_VERSION, lpszVersion); // Versionの設定
142- delete[] lpszVersion;
213+ LPTSTR lpszVersion = new TCHAR[MAX_LOADSTRING];
214+ ZeroMemory(lpszVersion, (sizeof(TCHAR) * MAX_LOADSTRING));
215+ if (lpszVersion) {
216+ ZeroMemory(lpszVersion, (sizeof(TCHAR) * MAX_LOADSTRING));
217+ _sntprintf_s(lpszVersion, MAX_LOADSTRING, _TRUNCATE, _T("%d.%d.%d.%d"), MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION);
218+ SetDlgItemText(hDlg, IDC_VERSION, lpszVersion); // Versionの設定
219+ delete[] lpszVersion;
220+ }
221+ else return (INT_PTR)FALSE;
143222 }
144223 return (INT_PTR)TRUE;
145224 case WM_CTLCOLORDLG:
--- /dev/null
+++ b/FlushMouse/FlushMouse.exe.manifest
@@ -0,0 +1,41 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3+ <assemblyIdentity
4+ type="win32"
5+ name="FlushMouse.exe"
6+ version="0.9.4.8"
7+ processorArchitecture="amd64"
8+ />
9+ <description>FlushMouse Application</description>
10+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
11+ <application>
12+ <!-- Windows 10 and Windows 11 -->
13+ <maxversiontested Id="10.0.19041.0"/>
14+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
15+ <!-- DPI Awareness -->
16+ <!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)] Value: PerMonitorV2 -->
17+ <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
18+ PerMonitorV2, PerMonitor
19+ </dpiAwareness>
20+ <!-- GDI Scaling -->
21+ <gdiScaling>true</gdiScaling>
22+ </application>
23+ </compatibility>
24+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
25+ <security>
26+ <requestedPrivileges>
27+ <!-- UAC settings -->
28+ <!--requestedExecutionLevel level="requireAdministrator" uiAccess="false"/-->
29+ <!--requestedExecutionLevel level="highestAvailable" uiAccess="false"/-->
30+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
31+ </requestedPrivileges>
32+ </security>
33+ </trustInfo>
34+ <!--file name="FlushMouseUI3.dll">
35+ <activatableClass
36+ name="FlushMouseUI3.Class"
37+ threadingModel="both"
38+ xmlns="urn:schemas-microsoft-com:winrt.v1" />
39+ </file-->
40+
41+</assembly>
\ No newline at end of file
--- a/FlushMouse/FlushMouse.vcxproj
+++ b/FlushMouse/FlushMouse.vcxproj
@@ -246,6 +246,9 @@
246246 <Project>{ccaf431f-ce8e-4879-9b1f-3f1df4ac2269}</Project>
247247 </ProjectReference>
248248 </ItemGroup>
249+ <ItemGroup>
250+ <Manifest Include="FlushMouse.exe.manifest" />
251+ </ItemGroup>
249252 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
250253 <ImportGroup Label="ExtensionTargets" />
251254 </Project>
\ No newline at end of file
--- a/FlushMouse/FlushMouse.vcxproj.filters
+++ b/FlushMouse/FlushMouse.vcxproj.filters
@@ -79,4 +79,7 @@
7979 <Filter>リソース ファイル</Filter>
8080 </Image>
8181 </ItemGroup>
82+ <ItemGroup>
83+ <Manifest Include="FlushMouse.exe.manifest" />
84+ </ItemGroup>
8285 </Project>
\ No newline at end of file
--- a/FlushMouse/FlushMouseLIB.cpp
+++ b/FlushMouse/FlushMouseLIB.cpp
@@ -18,7 +18,6 @@
1818 #include "Resource.h"
1919 #include "CommonDef.h"
2020 #include "..\FlushMouseDLL\EventlogDll.h"
21-#include "..\FlushMouseDLL\EventlogData.h"
2221 #include "..\FlushMouseDLL\GlobalHookDll.h"
2322 #include "..\FlushMouseDLL32\KeyboardHookDll32.h"
2423 #include "..\FlushMouseDLL32\MouseHookDll32.h"
@@ -28,16 +27,6 @@
2827 //
2928 // Define
3029 //
31-#define KB_MASK 0xffff0000
32-#define KB_JP 0x04110000
33-#define KB_US 0x04090000
34-#define LANG_MASK 0x0000ffff
35-#define LANG_IME 0x00000411
36-#define LANG_ENG 0x00000409
37-#define JP_IME (HKL)(KB_JP | LANG_IME)
38-#define JP_ENG (HKL)(KB_JP | LANG_ENG)
39-#define US_IME (HKL)(KB_US | LANG_IME)
40-#define US_ENG (HKL)(KB_US | LANG_ENG)
4130
4231 //
4332 // Struct Define
@@ -77,7 +66,7 @@ static UINT nCheckFocusTimerTickValue = FOCUSINITTIMERVALUE; // Timer tick
7766 static UINT_PTR nCheckFocusTimerID = CHECKFOCUSTIMERID; // Timer ID
7867 static UINT_PTR uCheckFocusTimer = NULL;
7968 // Timer for Poc
80-#define PROCINITTIMERVALUE 3000
69+#define PROCINITTIMERVALUE 1000
8170 #define CHECKPROCTIMERID 2
8271 static UINT nCheckProcTimerTickValue = PROCINITTIMERVALUE; // Timer tick
8372 static UINT_PTR nCheckProcTimerID = CHECKPROCTIMERID; // Timer ID
@@ -124,9 +113,9 @@ static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConversioning
124113 // Sub
125114 static BOOL bSendInputSub(UINT cInputs, LPINPUT pInputs);
126115 static BOOL bKBisEP();
116+static BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL);
127117 static VOID CALLBACK vCheckFocusTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
128118 static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
129-static LONG WINAPI lExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo);
130119 static BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam);
131120
132121 //
@@ -134,11 +123,8 @@ static BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam);
134123 //
135124 BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance)
136125 {
137- SetUnhandledExceptionFilter(&lExceptionFilter);
138-
139126 if (LoadString(Resource->hLoad(), IDS_APP_TITLE, szTitle, MAX_LOADSTRING) == 0) return FALSE;
140127
141- // Set Thread DPI Awareness V2 for High DPI
142128 SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
143129 SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
144130
@@ -155,7 +141,9 @@ BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance)
155141 PostMessage(hWnd, WM_DESTROY, NULL, NULL);
156142 for (int i = 3; i > 0; i--) {
157143 Sleep(500);
158- if (FindWindow(CLASS_FLUSHMOUSE, NULL) != NULL) {
144+ if ((hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL)) != NULL) {
145+ SetFocus(GetLastActivePopup(hWnd));
146+ PostMessage(hWnd, WM_DESTROY, NULL, NULL);
159147 if (i == 1) {
160148 vMessageBox(NULL, IDS_ALREADYRUN, MessageBoxTYPE);
161149 if (Resource != NULL) {
@@ -207,7 +195,7 @@ static ATOM MyRegisterClass(HINSTANCE hInstance)
207195 static HWND InitInstance(HINSTANCE hInstance, int nCmdShow)
208196 {
209197 UNREFERENCED_PARAMETER(nCmdShow);
210-#define WINDOWSTYLE (WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL)
198+#define WINDOWSTYLE WS_DISABLED
211199 // for TaskTray
212200 HWND hWnd = NULL; // メインウィンドウのハンドル
213201 hWnd = CreateWindowEx(
@@ -252,6 +240,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
252240 HANDLE_MSG(hWnd, WM_POWERBROADCAST, Cls_OnPowerBroadcast);
253241 HANDLE_MSG(hWnd, WM_EVENT_SYSTEM_FOREGROUNDEX, Cls_OnEventForegroundEx);
254242 HANDLE_MSG(hWnd, WM_CHECKIMESTARTCONVEX, Cls_OnCheckIMEStartConvertingEx);
243+ break;
255244
256245 default:
257246 if (!bReCreateTaskTrayWindow(hWnd, message)) {
@@ -287,7 +276,11 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
287276 HICON hIcon = NULL;
288277 if ((hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) != NULL) {
289278 if (bCreateTaskTrayWindow(hWnd, hIcon, szTitle) == FALSE) {
290- vMessageBox(hWnd, IDS_NOTREGISTERTT, MessageBoxTYPE);
279+ try {
280+ vMessageBox(hWnd, IDS_NOTREGISTERTT, MessageBoxTYPE);
281+ }
282+ catch (...) {
283+ }
291284 PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
292285 return FALSE;
293286 }
@@ -311,8 +304,8 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
311304 return FALSE;
312305 }
313306
314- if (bCheckExistingJPIME() && bEnableEPHelper) bForExplorerPatcherSWS(GetForegroundWindow(), FALSE, NULL, NULL);
315-
307+ if (bCheckExistingJPIME() && bEnableEPHelper) bForExplorerPatcherSWS(GetForegroundWindow(), FALSE, FALSE, NULL, NULL);
308+
316309 return TRUE;
317310 }
318311
@@ -325,8 +318,7 @@ static void Cls_OnDestroy(HWND hWnd)
325318
326319 vStopThreadHookTimer(hWnd);
327320
328- EXCEPTION_POINTERS ExceptionInfo{};
329- lExceptionFilter(&ExceptionInfo);
321+ SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0);
330322
331323 if (Profile != NULL) {
332324 Profile->bSetProfileData();
@@ -398,7 +390,7 @@ static void Cls_OnCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
398390 break;
399391 case IDM_EXIT:
400392 case IDR_TT_QUIT:
401- DestroyWindow(hWnd);
393+ PostMessage(hWnd, WM_DESTROY, (WPARAM)0, (LPARAM)0);
402394 break;
403395 }
404396 }
@@ -428,13 +420,7 @@ static void Cls_OnLButtonDownEx(HWND hWnd, int x, int y, HWND hForeground)
428420 UNREFERENCED_PARAMETER(y);
429421 UNREFERENCED_PARAMETER(hForeground);
430422 if (bEnableEPHelper) {
431- POINT pt{};
432- if (GetCursorPos(&pt)) {
433- RECT rc{};
434- if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
435- if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
436- }
437- bForExplorerPatcherSWS(hForeground, FALSE, NULL, NULL);
423+ bForExplorerPatcherSWS(hForeground, FALSE, FALSE, NULL, NULL);
438424 }
439425 return;
440426 }
@@ -458,9 +444,11 @@ static void Cls_OnLButtonUpEx(HWND hWnd, int x, int y, HWND hForeground)
458444 POINT pt{};
459445 if (GetCursorPos(&pt)) {
460446 RECT rc{};
461- if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
462- if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
463- if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
447+ if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
448+ if (FindWindow(L"Shell_TrayWnd", NULL) == GetForegroundWindow()) {
449+ if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
450+ if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
451+ }
464452 if (!Cursor->bStartDrawIMEModeThread(hWndObserved)) return;
465453 }
466454 }
@@ -493,23 +481,26 @@ static void Cls_OnEventForegroundEx(HWND hWnd, DWORD dwEvent, HWND hForeWnd)
493481 else {
494482 POINT pt{};
495483 if (GetCursorPos(&pt)) {
496- RECT rc{};
497- if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
498- if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
499484 if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
500485 }
501486 else {
502- _Post_equals_last_error_ DWORD err = GetLastError();
503- if (err == ERROR_ACCESS_DENIED) return;
504487 return;
505488 }
506489 }
507- if (bCheckExistingJPIME() && bEnableEPHelper) bForExplorerPatcherSWS(hWnd, FALSE, NULL, NULL);
490+ if (bCheckExistingJPIME() && bEnableEPHelper) bForExplorerPatcherSWS(hWnd, FALSE, FALSE, NULL, NULL); // @@@ for Explorer Patcher Simple Window Switcher
508491 if (bOffChangedFocus) {
509492 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
510493 }
511- if (!Cursor->bStartIMECursorChangeThread(hWndObserved)) return;
512- if (!Cursor->bStartDrawIMEModeThread(hWndObserved)) return;
494+ if (!Cursor->bStartIMECursorChangeThread(hWndObserved)) return; // error
495+ POINT pt{};
496+ if (GetCursorPos(&pt)) {
497+ RECT rc{};
498+ if (FindWindow(L"Shell_TrayWnd", NULL) == GetForegroundWindow()) {
499+ if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return; // error
500+ if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return; // Clicked on Notify Icon
501+ }
502+ if (!Cursor->bStartDrawIMEModeThread(hForeWnd)) return; // error
503+ }
513504 }
514505 }
515506 }
@@ -552,11 +543,11 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
552543 if ((fDown == FALSE)) { // Key up
553544 switch (vk) {
554545 case KEY_ONLY_CTRLUP:
555- if (bEnableEPHelper) bForExplorerPatcherSWS(hForeWnd, FALSE, NULL, NULL);
546+ if (bEnableEPHelper) bForExplorerPatcherSWS(hForeWnd, FALSE, FALSE, NULL, NULL);
556547 if (bDoModeDispByCtrlUp) {
557548 POINT pt{};
558549 if (GetCursorPos(&pt)) {
559- if (!Cursor->bStartDrawIMEModeThreadWait(WindowFromPoint(pt))) return; // error
550+ if (!Cursor->bStartDrawIMEModeThreadWait(WindowFromPoint(pt))) return;
560551 }
561552 }
562553 return;
@@ -574,34 +565,40 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
574565 case KEY_F10: // F10 (0x79)
575566 break;
576567 case KEY_IME_ON: // IME ON (0x16)
577- if (bEnableEPHelper) {
568+ bIMEInConverting = FALSE;
569+ if (bEnableEPHelper || bIMEModeForced) {
578570 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
579571 }
580572 break;
581573 case KEY_KANJI: // JP(IME/ENG) Alt + 漢字 (0x19)
582- if (bEnableEPHelper) {
583- while (GetAsyncKeyState(VK_MENU) & 0x8000)
584- {
585- Sleep(50);
586- }
587- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
588- if (bIMEModeForced != FALSE) {
589- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
574+ bIMEInConverting = FALSE;
575+ if (bEnableEPHelper || bIMEModeForced) {
576+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
577+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
578+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
579+ if (dwBeforeIMEMode != IMEOFF) {
580+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
581+ }
582+ else {
583+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
584+ }
590585 }
591586 }
592587 }
593588 break;
594589 case KEY_IME_OFF: // IME OFF (0x1a)
595- if (bEnableEPHelper) {
596- if (bIMEModeForced != FALSE) {
590+ bIMEInConverting = FALSE;
591+ if (bEnableEPHelper || bIMEModeForced) {
592+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
597593 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
598594 }
599595 }
600596 break;
601597 case KEY_CONVERT: // JP(IME/ENG) 変換 (0x1c)
602- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
598+ bIMEInConverting = FALSE;
599+ if (bEnableEPHelper || bIMEModeForced) {
603600 SetFocus(hForeWnd);
604- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
601+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
605602 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
606603 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
607604 }
@@ -615,8 +612,8 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
615612 break;
616613 case KEY_NONCONVERT: // JP(IME/ENG) 無変換 (0x1d)
617614 bIMEInConverting = FALSE;
618- if (bEnableEPHelper) {
619- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
615+ if (bEnableEPHelper || bIMEModeForced) {
616+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
620617 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
621618 if (((UINT64)hPreviousHKL & LANG_MASK) != LANG_IME) {
622619 PostMessage(hWnd, WM_SYSKEYDOWNUPEX, KEY_OEM_PA1, (0x80000000));
@@ -625,51 +622,55 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
625622 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
626623 }
627624 }
625+ else {
626+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
627+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
628+ }
629+ }
628630 }
629631 }
630632 break;
631633 case KEY_OEM_3: // JP(IME/ENG) [@] / US(ENG) IME ON (0xc0) = ['] ALT + 半角/全角 or 漢字
632634 case KEY_OEM_8: // JP(IME/ENG) [`] / UK(ENG) IME ON (0xdf) = ['] ALT + 半角/全角 or 漢字
633- if (bEnableEPHelper) {
634- while (GetAsyncKeyState(VK_MENU) & 0x8000)
635- {
636- Sleep(50);
635+ if (bEnableEPHelper || bIMEModeForced) {
636+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
637+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
637638 }
638- PostMessage(hWnd, WM_SYSKEYDOWNUPEX, KEY_OEM_IME_ON, (0x80000000));
639- Sleep(10);
640639 }
640+ break;
641641 return;
642642 case KEY_OEM_PA1: // US(ENG) 無変換 (0xeb)
643643 bIMEInConverting = FALSE;
644- if (bEnableEPHelper) {
645- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
646- if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
647- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
648- }
649- else { // KEY_OEM_PA1 is from US KB
650- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
651- }
644+ if (bEnableEPHelper || bIMEModeForced) {
645+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
646+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
652647 }
653648 }
654649 break;
655650 case KEY_OEM_ATTN: // JP(IME/ENG) 英数/CapsLock(0xf0)
656651 bIMEInConverting = FALSE;
657- if (bEnableEPHelper) {
658- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
652+ if (bEnableEPHelper || bIMEModeForced) {
653+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
659654 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
660655 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
661656 }
657+ else {
658+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
659+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
660+ }
661+ }
662662 }
663663 }
664664 break;
665665 case KEY_OEM_FINISH: // JP(IME/ENG) OEM カタカナ (0xf1)
666- if (bEnableEPHelper) {
667- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
666+ bIMEInConverting = FALSE;
667+ if (bEnableEPHelper || bIMEModeForced) {
668+ if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
668669 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
669670 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENKANA_IMEON);
670671 }
671672 else {
672- if (bIMEModeForced != FALSE) {
673+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
673674 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENKANA_IMEON);
674675 }
675676 }
@@ -677,28 +678,35 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
677678 }
678679 break;
679680 case KEY_OEM_COPY: // JP(IME/ENG) OEM ひらがな (0xf2)
680- if (bEnableEPHelper) {
681- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
681+ bIMEInConverting = FALSE;
682+ if (bEnableEPHelper || bIMEModeForced) {
683+ if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
682684 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
683685 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
684686 }
685687 else {
686- if (bIMEModeForced != FALSE) {
688+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
687689 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
688690 }
689691 }
690692 }
691693 }
692694 break;
693- case KEY_OEM_IME_OFF: // JP(IME/ENG) IME OFF (0xf3) But It's IME ON when key up
694- if (bEnableEPHelper) {
695- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
695+ case KEY_OEM_IME_OFF: // JP(IME/ENG) IME OFF
696+ bIMEInConverting = FALSE;
697+ if (bEnableEPHelper || bIMEModeForced) {
698+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
699+ if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
696700 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
697- Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
701+ if (dwBeforeIMEMode == IMEOFF) {
702+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
703+ }
698704 }
699705 else {
700706 if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
701- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
707+ if (dwBeforeIMEMode != IMEOFF) {
708+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
709+ }
702710 }
703711 }
704712 }
@@ -706,14 +714,21 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
706714 break;
707715 case KEY_OEM_IME_ON: // JP(IME/ENG) IME ON
708716 bIMEInConverting = FALSE;
709- if (bEnableEPHelper) {
710- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
717+ if (bEnableEPHelper || bIMEModeForced) {
718+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
719+ if (bForExplorerPatcherSWS(GetForegroundWindow(), bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
711720 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
712- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
721+ if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
722+ if (dwBeforeIMEMode == IMEOFF) {
723+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
724+ }
725+ }
713726 }
714727 else {
715728 if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
716- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
729+ if (dwBeforeIMEMode != IMEOFF) {
730+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
731+ }
717732 }
718733 }
719734 }
@@ -722,9 +737,9 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
722737 case KEY_OEM_BACKTAB: // OEM Alt+カタカナ/ひらがな (0xf5)
723738 case KEY_FF: // US(ENG) 変換/ひら/カタ (0xff)
724739 bIMEInConverting = FALSE;
725- if (bEnableEPHelper) {
740+ if (bEnableEPHelper || bIMEModeForced) {
726741 SetFocus(hForeWnd);
727- if (bForExplorerPatcherSWS(hForeWnd, TRUE, &hNewHKL, &hPreviousHKL)) {
742+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
728743 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
729744 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
730745 }
@@ -744,11 +759,10 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
744759 case KEY_OEM_ATTN: // JP(IME/ENG) 英数/CapsLock(0xf0)
745760 case KEY_OEM_FINISH: // JP(IME/ENG) OEM カタカナ (0xf1)
746761 case KEY_OEM_COPY: // JP(IME/ENG) OEM ひらがな (0xf2)
747- if (bEnableEPHelper) {
762+ if (bEnableEPHelper) {
748763 PostMessage(hWnd, WM_SYSKEYDOWNUPEX, vk, (0x80000000));
749- return;
750764 }
751- break;
765+ return;
752766 default:
753767 return;
754768 }
@@ -777,7 +791,7 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
777791 // for Explorer Patcher Simple Window Switcher
778792 // bForExplorerPatcherSWS()
779793 //
780-BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, LPHKL lpNewHKL, LPHKL lpPreviousHKL)
794+BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForcedChange, LPHKL lpNewHKL, LPHKL lpPreviousHKL)
781795 {
782796 if (hForeWnd == NULL) return FALSE;
783797 BOOL bRet = FALSE;
@@ -785,76 +799,93 @@ BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, LPHKL lpNewHKL, L
785799 HKL hPreviousHKL = NULL;
786800 DWORD dwProcessID = 0;
787801 DWORD dwThreadID = 0;
788- dwThreadID = GetWindowThreadProcessId(hForeWnd, &dwProcessID);
789- if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) {
790- int iKeyboardType = GetKeyboardType(1);
791- if (iKeyboardType == 2) hPreviousHKL = hkl;
792- else hPreviousHKL = 0x00000000;
793- if ((bChangeToIME && (hkl != JP_IME)) || (hkl == US_ENG)) {
794- hkl = JP_IME;
795- if (ActivateKeyboardLayout(hkl, KLF_SETFORPROCESS) != 0) {
796- if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) { // Re Check
797- if (hkl != JP_IME) {
798- int iKBList = 0;
799- if ((iKBList = GetKeyboardLayoutList(0, NULL)) != 0) {
800- LPHKL lpHKL = NULL;
801- if ((lpHKL = new HKL[sizeof(HKL) * iKBList]) != NULL) {
802- ZeroMemory(lpHKL, (sizeof(HKL) * iKBList));
803- if ((iKBList = GetKeyboardLayoutList(iKBList, lpHKL)) != 0) {
804- int iKB = 0, iJP_IME = 0;
805- for (int i = 0; i < iKBList; i++) {
806- if (lpHKL[i] == hkl) iKB = i;
807- if (lpHKL[i] == JP_IME) iJP_IME = i;
808- }
809- while (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
810- Sleep(50);
811- }
812- iKB = iKBList - iKB + iJP_IME;
813- LPINPUT lpInputs = NULL;
814- if ((lpInputs = new INPUT[sizeof(INPUT) * (iKB * 2 + 2)]) != NULL) {
815- ZeroMemory(lpInputs, sizeof(INPUT) * (iKB * 2 + 2));
816- lpInputs[0].type = INPUT_KEYBOARD; lpInputs[0].ki.wVk = VK_LWIN;
817- int i = 0;
818- for (; i < ((iKB * 2)); i = i + 2) {
819- lpInputs[i + 1].type = INPUT_KEYBOARD; lpInputs[i + 1].ki.wVk = VK_SPACE;
820- lpInputs[i + 2].type = INPUT_KEYBOARD; lpInputs[i + 2].ki.wVk = VK_SPACE; lpInputs[i + 2].ki.dwFlags = KEYEVENTF_KEYUP;
821- }
822- lpInputs[iKB * 2 + 1].type = INPUT_KEYBOARD; lpInputs[iKB * 2 + 1].ki.wVk = VK_LWIN; lpInputs[iKB * 2 + 1].ki.dwFlags = KEYEVENTF_KEYUP;
823- if (bSendInputSub((UINT)(iKB * 2 + 2), lpInputs)) {
824- hkl = lpHKL[iJP_IME];
825- if (hkl != NULL) {
826- if (ActivateKeyboardLayout(hkl, KLF_SETFORPROCESS) != 0) {
827- EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
828- bRet = TRUE;
829- }
830- }
831- }
832- delete[] lpInputs;
833- }
802+ DWORD dwInputLocale = 0;
803+ if ((dwThreadID = GetWindowThreadProcessId(hForeWnd, &dwProcessID)) != 0) {
804+ if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) {
805+ if ((dwInputLocale = Cime->dwGetInputLocale()) != 0) {
806+ hkl = (HKL)(((UINT64)hkl & KB_MASK) | (dwInputLocale & LANG_MASK));
807+ int iKeyboardType = GetKeyboardType(1);
808+ if (iKeyboardType == 2) hPreviousHKL = hkl;
809+ else hPreviousHKL = US_ENG;
810+ if ((bChangeToIME && (hkl != JP_IME)) || (hkl == US_ENG) || bIMEModeForcedChange) {
811+ hkl = JP_IME;
812+ if (ActivateKeyboardLayout(hkl, (KLF_SETFORPROCESS | KLF_REORDER)) != 0) {
813+ //EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
814+ //Cime->vActivateIME(hForeWnd);
815+ if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) { // Re Check
816+ if (hkl != JP_IME) {
817+ if (bChangeHKLbySendInput(JP_IME, hkl)) {
818+ hkl = JP_IME;
819+ bRet = TRUE;
834820 }
835- delete[] lpHKL;
821+ }
822+ else {
823+ bRet = TRUE;
836824 }
837825 }
838826 }
839- else {
840- EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
841- bRet = TRUE;
842- }
843827 }
844828 }
845829 }
846- else {
847- if (hPreviousHKL != JP_IME) EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
848- bRet = TRUE;
849- }
850830 }
851- if (bRet) Cime->vActivateIME(hForeWnd);
831+ if (bRet) {
832+ EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
833+ Cime->vActivateIME(hForeWnd);
834+ }
852835 if (lpNewHKL != NULL) *lpNewHKL = hkl;
853836 if (lpPreviousHKL != NULL) *lpPreviousHKL = hPreviousHKL;
854837 return bRet;
855838 }
856839
857840 //
841+// bChangeHKLbySendInput();
842+//
843+BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL)
844+{
845+ BOOL bRet = FALSE;
846+ int iKBList = 0;
847+ if ((iKBList = GetKeyboardLayoutList(0, NULL)) != 0) {
848+ LPHKL lpHKL = NULL;
849+ if ((lpHKL = new HKL[sizeof(HKL) * iKBList]) != NULL) {
850+ ZeroMemory(lpHKL, (sizeof(HKL) * iKBList));
851+ if (GetKeyboardLayoutList(iKBList, lpHKL) != 0) {
852+ int iPreviousKB = 0, iNewKB = 0;
853+ for (int i = 0; i < iKBList; i++) {
854+ if (lpHKL[i] == hPreviousHKL) iPreviousKB = i;
855+ if (lpHKL[i] == hNewHKL) iNewKB = i;
856+ }
857+ //if ((GetAsyncKeyState(VK_SHIFT) & 0x8000)) iKB = iKBList - iKB;
858+ while (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
859+ Sleep(1);
860+ }
861+ int iKB = iKBList - iPreviousKB + iNewKB;
862+ if (iNewKB != iPreviousKB) {
863+ LPINPUT lpInputs = NULL;
864+ if ((lpInputs = new INPUT[sizeof(INPUT) * (iKB * 2 + 2)]) != NULL) {
865+ ZeroMemory(lpInputs, sizeof(INPUT) * (iKB * 2 + 2));
866+ lpInputs[0].type = INPUT_KEYBOARD; lpInputs[0].ki.wVk = VK_LWIN;
867+ int i = 0;
868+ for (; i < ((iKB * 2)); i = i + 2) {
869+ lpInputs[i + 1].type = INPUT_KEYBOARD; lpInputs[i + 1].ki.wVk = VK_SPACE;
870+ lpInputs[i + 2].type = INPUT_KEYBOARD; lpInputs[i + 2].ki.wVk = VK_SPACE; lpInputs[i + 2].ki.dwFlags = KEYEVENTF_KEYUP;
871+ }
872+ lpInputs[iKB * 2 + 1].type = INPUT_KEYBOARD; lpInputs[iKB * 2 + 1].ki.wVk = VK_LWIN; lpInputs[iKB * 2 + 1].ki.dwFlags = KEYEVENTF_KEYUP;
873+ if (bSendInputSub((UINT)(iKB * 2 + 2), lpInputs)) {
874+ bRet = TRUE;
875+ }
876+ if (lpInputs) delete[] lpInputs;
877+ }
878+ }
879+ else bRet = TRUE;
880+
881+ }
882+ if (lpHKL) delete[] lpHKL;
883+ }
884+ }
885+ return bRet;
886+}
887+
888+//
858889 // bEnumChildProcChangeHKL()
859890 //
860891 BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam)
@@ -887,7 +918,7 @@ BOOL bCheckExistingJPIME()
887918 }
888919 }
889920 }
890- delete[] lpHKL;
921+ if (lpHKL) delete[] lpHKL;
891922 }
892923 }
893924 HWND hWnd = FindWindow(CLASS_FLUSHMOUSE32, NULL);
@@ -908,18 +939,6 @@ static BOOL bSendInputSub(UINT cInputs, LPINPUT pInputs)
908939 }
909940
910941 //
911-// lExceptionFilter()
912-//
913-static LONG WINAPI lExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
914-{
915- UNREFERENCED_PARAMETER(pExceptionInfo);
916-
917- SystemParametersInfo(SPI_SETCURSORS, 0, NULL, 0);
918-
919- return EXCEPTION_CONTINUE_SEARCH;
920-}
921-
922-//
923942 // bStartThreadHookTimer()
924943 //
925944 BOOL bStartThreadHookTimer(HWND hWnd)
@@ -1091,15 +1110,17 @@ CResource::CResource(LPCTSTR lpszResFile)
10911110 hModRes = NULL;
10921111 iResourceLoadCount = 0;
10931112 szResFile = new TCHAR[_MAX_PATH];
1094- ZeroMemory(szResFile, _MAX_PATH);
1095- _tcsncpy_s(szResFile, _MAX_PATH, lpszResFile, _TRUNCATE);
1113+ if (szResFile) {
1114+ ZeroMemory(szResFile, sizeof(TCHAR) * _MAX_PATH);
1115+ _tcsncpy_s(szResFile, _MAX_PATH, lpszResFile, _TRUNCATE);
1116+ }
10961117 }
10971118
10981119 CResource::~CResource()
10991120 {
11001121 hModRes = NULL;
11011122 iResourceLoadCount = 0;
1102- delete[] szResFile;
1123+ if (szResFile) delete[] szResFile;
11031124 szResFile = NULL;
11041125 }
11051126
--- a/FlushMouse/FlushMouseLIB.h
+++ b/FlushMouse/FlushMouseLIB.h
@@ -47,7 +47,7 @@ private:
4747 extern BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance);
4848 extern BOOL bStartThreadHookTimer(HWND hWnd);
4949 extern VOID vStopThreadHookTimer(HWND hWnd);
50-extern BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, LPHKL lpNewHKL, LPHKL lpPreviousHKL);
50+extern BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForcedChange, LPHKL lpNewHKL, LPHKL lpPreviousHKL);
5151 extern BOOL bCheckExistingJPIME();
5252
5353 //
--- a/FlushMouse/FlushMouseSub.cpp
+++ b/FlushMouse/FlushMouseSub.cpp
@@ -18,7 +18,6 @@
1818 #include "Resource.h"
1919 #include "..\FlushMouseDLL\GlobalHookDll.h"
2020 #include "..\FlushMouseDLL\EventlogDll.h"
21-#include "..\FlushMouseDLL\EventlogData.h"
2221 #include "..\FlushMouseDLL32\FlushMouseDll32.h"
2322 #include "..\MiscLIB\CRegistry.h"
2423
@@ -61,26 +60,44 @@ BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitle)
6160 nIco.guidItem = GUID_NULL;
6261 nIco.uFlags = NIF_INFO | NIF_MESSAGE | NIF_ICON | NIF_TIP;
6362 nIco.uCallbackMessage = WM_TASKTRAYEX;
64- nIco.dwState = 0;
65- nIco.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON | NIIF_NOSOUND | NIIF_RESPECT_QUIET_TIME | NIIF_LARGE_ICON;
63+ nIco.dwState = NIS_HIDDEN | NIS_SHAREDICON;
64+ nIco.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON | NIIF_NOSOUND;
6665 nIco.uVersion = NOTIFYICON_VERSION_4;
6766 nIco.hIcon = hIcon;
6867 if ((nIco.hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) == NULL) {
6968 return FALSE;
7069 }
7170 _tcsncpy_s(nIco.szTip, ARRAYSIZE(nIco.szTip), lpszTitle, _TRUNCATE);
72- if (Shell_NotifyIcon(NIM_ADD, &nIco) == FALSE) { // Add TaskTray Icon
73- _Post_equals_last_error_ DWORD err = GetLastError();
74- if (err == ERROR_TIMEOUT) {
75- Sleep(1000);
76- if (Shell_NotifyIcon(NIM_ADD, &nIco) == FALSE) { // Retry once
71+ BOOL bRet = FALSE;
72+ try {
73+ throw bRet = Shell_NotifyIcon(NIM_ADD, &nIco);
74+ }
75+ catch (BOOL) {
76+ if (!bRet) {
77+ _Post_equals_last_error_ DWORD err = GetLastError();
78+ if (err == ERROR_TIMEOUT) {
79+ Sleep(1000);
80+ try {
81+ throw bRet = Shell_NotifyIcon(NIM_ADD, &nIco);
82+ }
83+ catch (BOOL) {
84+ if (!bRet) {
85+ return FALSE;
86+ }
87+ }
88+ catch (...) {
89+ return FALSE;
90+ }
91+ }
92+ else {
7793 return FALSE;
7894 }
7995 }
80- else {
81- return FALSE;
82- }
8396 }
97+ catch (...) {
98+ return FALSE;
99+ }
100+
84101 if ((uTaskbarCreatedMessage = RegisterWindowMessage(_T("TaskbarCreated"))) == 0) {
85102 bDestroyTaskTrayWindow(hWnd);
86103 return FALSE;
@@ -137,9 +154,16 @@ BOOL bDestroyTaskTrayWindow(HWND hWnd)
137154 nIco.uID = NOTIFYICONDATA_ID;
138155 nIco.guidItem = GUID_NULL;
139156 nIco.uFlags = 0;
140- if (Shell_NotifyIcon(NIM_DELETE, &nIco) != FALSE) {
141- bTaskTray = FALSE;
142- return TRUE;
157+ try {
158+ throw Shell_NotifyIcon(NIM_DELETE, &nIco);
159+ }
160+ catch (BOOL bRet) {
161+ if (bRet) {
162+ bTaskTray = FALSE;
163+ return TRUE;
164+ }
165+ }
166+ catch (...) {
143167 }
144168 }
145169 return FALSE;
@@ -156,11 +180,19 @@ BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect)
156180 nii.hWnd = hWnd;
157181 nii.uID = NOTIFYICONDATA_ID;
158182 nii.guidItem = GUID_NULL;
159- HRESULT hResult = E_FAIL;
160- if ((hResult = Shell_NotifyIconGetRect(&nii, lpRect)) != S_OK) {
183+ try {
184+ throw Shell_NotifyIconGetRect(&nii, lpRect);
185+ }
186+ catch (HRESULT hResult) {
187+ if (hResult != S_OK) {
188+ return FALSE;
189+ }
190+ return TRUE;
191+ }
192+ catch (...) {
193+ PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
161194 return FALSE;
162195 }
163- return TRUE;
164196 }
165197 return FALSE;
166198 }
@@ -194,6 +226,7 @@ void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
194226 SetForegroundWindow(hWnd);
195227 APPBARDATA stAppBarData{};
196228 stAppBarData.cbSize = sizeof(APPBARDATA);
229+ stAppBarData.hWnd = hWnd;
197230 SHAppBarMessage(ABM_GETTASKBARPOS, &stAppBarData);
198231 UINT uFlags = 0;
199232 switch (stAppBarData.uEdge) {
@@ -221,8 +254,6 @@ void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
221254 //EnableMenuItem(hSubMenu, IDR_TT_SETTING, MF_BYCOMMAND | MF_DISABLED);
222255 }
223256 TrackPopupMenu(hSubMenu, uFlags, pt.x, pt.y, 0, hWnd, NULL);
224- DestroyMenu(hMenu);
225- PostMessage(hWnd, WM_NULL, 0, 0);
226257 break;
227258 }
228259 }
@@ -705,12 +736,15 @@ CFlushMouseHook::CFlushMouseHook()
705736 bKeyboardHook64 = FALSE;
706737 bMouseHook64 = FALSE;
707738 bHook32Dll = FALSE;
708- lpstProcessInfomation = NULL;
739+ lpstProcessInfomation = new PROCESS_INFORMATION[sizeof(PROCESS_INFORMATION)];
740+ if (lpstProcessInfomation) ZeroMemory(lpstProcessInfomation, sizeof(PROCESS_INFORMATION));
709741 }
710742
711743 CFlushMouseHook::~CFlushMouseHook()
712744 {
713745 bHookUnset();
746+ if (lpstProcessInfomation) delete[] lpstProcessInfomation;
747+ lpstProcessInfomation = NULL;
714748 }
715749 //
716750 // bHookSet()
@@ -738,69 +772,37 @@ BOOL CFlushMouseHook::bHookUnset()
738772 }
739773
740774 //
741-// bHook64DllLoad()
742-//
743-BOOL CFlushMouseHook::bHook64DllLoad(LPCTSTR lpszDll64Name)
744-{
745- DWORD dwSize = 0;
746- dwSize = ExpandEnvironmentStrings(lpszDll64Name, NULL, 0);
747- LPTSTR lpszBuffer = new TCHAR[dwSize];
748- ZeroMemory(lpszBuffer, dwSize);
749- dwSize = ExpandEnvironmentStrings(lpszDll64Name, lpszBuffer, dwSize);
750- BOOL bRet = FALSE;
751- if (hHook64Dll == NULL) {
752- if ((hHook64Dll = LoadLibraryEx(lpszBuffer, NULL, 0)) != NULL) {
753- bRet = TRUE;
754- }
755- }
756- delete[] lpszBuffer;
757- return bRet;
758-}
759-
760-//
761-// bHook64DllUnload()
762-//
763-BOOL CFlushMouseHook::bHook64DllUnload()
764-{
765- if (hHook64Dll != NULL) {
766- if (!FreeLibrary(hHook64Dll)) {
767- return FALSE;
768- }
769- }
770- hHook64Dll = NULL;
771- return TRUE;
772-}
773-
774-//
775775 // bHook32DllStart()
776776 //
777777 BOOL CFlushMouseHook::bHook32DllStart(HWND hWnd, LPCTSTR lpszExec32Name)
778778 {
779779 #define COMAMANDLINESIZE (sizeof(_T(" ")) * (sizeof(unsigned long long) + 1))
780+ BOOL bRet = FALSE;
780781 DWORD dwSize = 0;
781782 dwSize = ExpandEnvironmentStrings(lpszExec32Name, NULL, 0);
782783 LPTSTR lpszBuffer = new TCHAR[dwSize];
783- ZeroMemory(lpszBuffer, dwSize);
784- dwSize = ExpandEnvironmentStrings(lpszExec32Name, lpszBuffer, dwSize);
785-
786- LPTSTR lpszCommandLine = NULL;
787- lpszCommandLine = new TCHAR[dwSize + COMAMANDLINESIZE];
788- ZeroMemory(lpszCommandLine, (dwSize + sizeof(COMAMANDLINESIZE)));
789- _sntprintf_s(lpszCommandLine, (dwSize + COMAMANDLINESIZE), _TRUNCATE, _T("%s %llu"), lpszBuffer, (unsigned long long)hWnd);
790- if (lpszBuffer != NULL) delete[] lpszBuffer;
791-
792- lpstProcessInfomation = new PROCESS_INFORMATION[sizeof(PROCESS_INFORMATION)];
793- ZeroMemory(lpstProcessInfomation, sizeof(PROCESS_INFORMATION));
794- STARTUPINFO stStartupInfo{}; stStartupInfo.cb = sizeof(STARTUPINFO);
795- BOOL bRet = FALSE;
796- if ((bRet = CreateProcess(NULL, lpszCommandLine, NULL, NULL, TRUE,
797- NORMAL_PRIORITY_CLASS, NULL, NULL, &stStartupInfo, lpstProcessInfomation)) == FALSE) {
798- delete[] lpstProcessInfomation;
799- }
800- else {
801- bHook32Dll = TRUE;
784+ if (lpszBuffer) {
785+ ZeroMemory(lpszBuffer, dwSize);
786+ dwSize = ExpandEnvironmentStrings(lpszExec32Name, lpszBuffer, dwSize);
787+
788+ LPTSTR lpszCommandLine = NULL;
789+ lpszCommandLine = new TCHAR[dwSize + COMAMANDLINESIZE];
790+ if (lpszCommandLine) {
791+ ZeroMemory(lpszCommandLine, (dwSize + sizeof(COMAMANDLINESIZE)));
792+ _sntprintf_s(lpszCommandLine, (dwSize + COMAMANDLINESIZE), _TRUNCATE, _T("%s %llu"), lpszBuffer, (unsigned long long)hWnd);
793+ if (lpstProcessInfomation) {
794+ STARTUPINFO stStartupInfo{}; stStartupInfo.cb = sizeof(STARTUPINFO);
795+ if ((bRet = CreateProcess(NULL, lpszCommandLine, NULL, NULL, TRUE,
796+ NORMAL_PRIORITY_CLASS, NULL, NULL, &stStartupInfo, lpstProcessInfomation)) == FALSE) {
797+ }
798+ else {
799+ bHook32Dll = TRUE;
800+ }
801+ }
802+ delete[] lpszCommandLine;
803+ }
804+ delete[] lpszBuffer;
802805 }
803- if (lpszCommandLine != NULL) delete[] lpszCommandLine;
804806 return bRet;
805807 }
806808
@@ -812,37 +814,38 @@ BOOL CFlushMouseHook::bHook32DllStop()
812814 #define TIMEOUT 1000
813815 if (!bHook32Dll) return TRUE;
814816 BOOL bRet = FALSE;
815- if (lpstProcessInfomation->hProcess != NULL) {
816- if (!EnumWindows((WNDENUMPROC)&CFlushMouseHook::bEnumWindowsProcHookStop, (LPARAM)lpstProcessInfomation)) {
817- if (GetLastError() == ERROR_SUCCESS) {
818- DWORD dwRet = WaitForSingleObject(lpstProcessInfomation->hProcess, TIMEOUT);
819- switch (dwRet) {
820- case WAIT_OBJECT_0:
821- bRet = TRUE;
822- break;
823- case WAIT_FAILED:
824- case WAIT_ABANDONED:
825- case WAIT_TIMEOUT:
826- default:
827- if (TerminateProcess(lpstProcessInfomation->hProcess, 0) != 0) {
817+ if (lpstProcessInfomation != NULL) {
818+ if (lpstProcessInfomation->hProcess != NULL) {
819+ if (!EnumWindows((WNDENUMPROC)&CFlushMouseHook::bEnumWindowsProcHookStop, (LPARAM)lpstProcessInfomation)) {
820+ if (GetLastError() == ERROR_SUCCESS) {
821+ DWORD dwRet = WaitForSingleObject(lpstProcessInfomation->hProcess, TIMEOUT);
822+ switch (dwRet) {
823+ case WAIT_OBJECT_0:
824+ bRet = TRUE;
825+ break;
826+ case WAIT_FAILED:
827+ case WAIT_ABANDONED:
828+ case WAIT_TIMEOUT:
829+ default:
830+ if (TerminateProcess(lpstProcessInfomation->hProcess, 0)) {
831+ bRet = TRUE;
832+ }
828833 bRet = TRUE;
829834 }
835+ DWORD dwExitCode;
836+ if (!GetExitCodeProcess(lpstProcessInfomation->hProcess, &dwExitCode)) {
837+ bRet = FALSE;
838+ }
839+ if (lpstProcessInfomation->hProcess != NULL) {
840+ CloseHandle(lpstProcessInfomation->hProcess);
841+ }
830842 }
831- DWORD dwExitCode;
832- if (!GetExitCodeProcess(lpstProcessInfomation->hProcess, &dwExitCode)) {
833- bRet = FALSE;
834- }
835- if (lpstProcessInfomation->hProcess != NULL) {
836- CloseHandle(lpstProcessInfomation->hProcess);
843+ if (lpstProcessInfomation->hThread != NULL) {
844+ CloseHandle(lpstProcessInfomation->hThread);
837845 }
838846 }
839- if (lpstProcessInfomation->hThread != NULL) {
840- CloseHandle(lpstProcessInfomation->hThread);
841- }
842847 }
843848 }
844- delete[] lpstProcessInfomation;
845- lpstProcessInfomation = NULL;
846849 return bRet;
847850 }
848851
--- a/FlushMouse32/FlushMouse32.cpp
+++ b/FlushMouse32/FlushMouse32.cpp
@@ -28,9 +28,8 @@
2828 //
2929 // Define
3030 //
31-#define MAX_LOADSTRING 100
3231 // Timer
33-#define PROCINITTIMERVALUE 3000
32+#define PROCINITTIMERVALUE 1000
3433 #define CHECKPROCTIMERID 2
3534 static UINT nCheckProcTimerTickValue = PROCINITTIMERVALUE; // Timer tick
3635 static UINT_PTR nCheckProcTimerID = CHECKPROCTIMERID; // Timer ID
@@ -71,7 +70,6 @@ static void Cls_OnCheckExistingJPIMEEx(HWND hWnd, BOOL bEPHelper);
7170 // Sub
7271 static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DWORD dwTime);
7372 static BOOL bReportEvent(DWORD dwEventID, WORD wCategory);
74-static LONG WINAPI lExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo);
7573 static void vMessageBox(HWND hWnd, UINT uID, UINT uType);
7674
7775 //
@@ -87,11 +85,14 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
8785 _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
8886 #endif
8987
90- SetUnhandledExceptionFilter(&lExceptionFilter);
88+ HANDLE hHandle = GetCurrentProcess();
89+ if (!SetPriorityClass(hHandle, NORMAL_PRIORITY_CLASS)) {
90+ return (-1);
91+ }
9192
9293 if (*lpCmdLine == _T('\0')) {
9394 hParentWnd = NULL;
94- vMessageBox(NULL, IDS_NOTFORKBY64, MessageBoxTYPE); // 不正起動のためメッセージを表示
95+ vMessageBox(NULL, IDS_NOTFORKBY64, MessageBoxTYPE);
9596 return (-1);
9697 }
9798 else {
@@ -118,7 +119,9 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
118119 PostMessage(hWnd, WM_DESTROY, NULL, NULL);
119120 for (int i = 3; i > 0; i--) {
120121 Sleep(500);
121- if (FindWindow(CLASS_FLUSHMOUSE32, NULL) != NULL) {
122+ if ((hWnd = FindWindow(CLASS_FLUSHMOUSE32, NULL)) != NULL) {
123+ SetFocus(GetLastActivePopup(hWnd));
124+ PostMessage(hWnd, WM_DESTROY, NULL, NULL);
122125 if (i == 1) {
123126 vMessageBox(NULL, IDS_ALREADYRUN, MessageBoxTYPE);
124127 return (-1);
@@ -128,7 +131,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
128131 }
129132 }
130133
131- if (!InitInstance(hInstance, nCmdShow)) { // Window作成
134+ if (!InitInstance(hInstance, nCmdShow)) {
132135 return (-1);
133136 }
134137
@@ -254,8 +257,8 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
254257 //
255258 static void Cls_OnDestroy(HWND hWnd)
256259 {
257- EXCEPTION_POINTERS ExceptionInfo{};
258- lExceptionFilter(&ExceptionInfo);
260+ bKeyboardHookLLUnset32();
261+ bMouseHookUnset32();
259262
260263 if (uCheckProcTimer != NULL) {
261264 if (KillTimer(hWnd, nCheckProcTimerID)) {
@@ -273,7 +276,7 @@ static void Cls_OnCheckExistingJPIMEEx(HWND hWnd, BOOL bEPHelper)
273276 {
274277 UNREFERENCED_PARAMETER(hWnd);
275278 if (!bSetEnableEPHelperLL32(bEPHelper)) {
276- DestroyWindow(hWnd);
279+ PostMessage(hWnd, WM_DESTROY, (WPARAM)0, (LPARAM)0);
277280 }
278281 }
279282
@@ -294,27 +297,25 @@ static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DW
294297 nIco.uID = NOTIFYICONDATA_ID;
295298 nIco.guidItem = GUID_NULL;
296299 nIco.uFlags = 0;
297- if (Shell_NotifyIcon(NIM_DELETE, &nIco) == FALSE) {
298- bReportEvent(MSG_RESTART_EVENT, APPLICATION32_CATEGORY);
299- PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
300+ try {
301+ throw Shell_NotifyIcon(NIM_DELETE, &nIco); // Delete TaskTray Icon
302+ }
303+ catch (BOOL bRet) {
304+ if (!bRet) {
305+ return;
306+ }
307+ }
308+ catch (...) {
309+ return;
300310 }
311+ bReportEvent(MSG_RESTART_EVENT, APPLICATION32_CATEGORY); // FlushMouseが動いていないため再起動する
312+ PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL); // Quit
301313 }
302314 }
303315 return;
304316 }
305317
306318 //
307-// lExceptionFilter()
308-//
309-static LONG WINAPI lExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo)
310-{
311- UNREFERENCED_PARAMETER(pExceptionInfo);
312- bKeyboardHookLLUnset32(); // Keyboard Hook LL の解除
313- bMouseHookUnset32(); // Mouse Hook の解除
314- return EXCEPTION_CONTINUE_SEARCH;
315-}
316-
317-//
318319 // bReportEvent()
319320 //
320321 static BOOL bReportEvent(DWORD dwEventID, WORD wCategory)
--- /dev/null
+++ b/FlushMouse32/FlushMouse32.exe.manifest
@@ -0,0 +1,34 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3+ <assemblyIdentity
4+ type="win32"
5+ name="FlushMouse32.exe"
6+ version="0.2.0.1"
7+ processorArchitecture="x86"
8+ />
9+ <description>FlushMouse Application</description>
10+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
11+ <application>
12+ <!-- Windows 10 and Windows 11 -->
13+ <maxversiontested Id="10.0.19041.0"/>
14+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
15+ <!-- DPI Awareness -->
16+ <!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)] Value: PerMonitorV2 -->
17+ <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
18+ PerMonitorV2, PerMonitor
19+ </dpiAwareness>
20+ <!-- GDI Scaling -->
21+ <gdiScaling>true</gdiScaling>
22+ </application>
23+ </compatibility>
24+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
25+ <security>
26+ <requestedPrivileges>
27+ <!-- UAC settings -->
28+ <!--requestedExecutionLevel level="requireAdministrator" uiAccess="false"/-->
29+ <!--requestedExecutionLevel level="highestAvailable" uiAccess="false"/-->
30+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
31+ </requestedPrivileges>
32+ </security>
33+ </trustInfo>
34+</assembly>
--- a/FlushMouse32/FlushMouse32.vcxproj
+++ b/FlushMouse32/FlushMouse32.vcxproj
@@ -219,6 +219,9 @@
219219 <Project>{3d3f632c-75bb-4830-aa8e-0871c6aa1a72}</Project>
220220 </ProjectReference>
221221 </ItemGroup>
222+ <ItemGroup>
223+ <Manifest Include="FlushMouse32.exe.manifest" />
224+ </ItemGroup>
222225 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
223226 <ImportGroup Label="ExtensionTargets">
224227 </ImportGroup>
--- a/FlushMouse32/FlushMouse32.vcxproj.filters
+++ b/FlushMouse32/FlushMouse32.vcxproj.filters
@@ -55,4 +55,7 @@
5555 <Filter>リソース ファイル</Filter>
5656 </Image>
5757 </ItemGroup>
58+ <ItemGroup>
59+ <Manifest Include="FlushMouse32.exe.manifest" />
60+ </ItemGroup>
5861 </Project>
\ No newline at end of file
--- a/FlushMouseDLL/EventlogData.h
+++ b/FlushMouseDLL/EventlogData.h
@@ -6,6 +6,7 @@
66 // #0000 2023/04/13 JeffyTS New edit.
77 //
88 //
9+//
910 // Categories of events.
1011 //
1112 //
@@ -98,6 +99,15 @@
9899 #define POWERNOTIFICATION_CATEGORY ((DWORD)0x00000010L)
99100
100101 //
102+// MessageId: TASKSCHDULER_CATEGORY
103+//
104+// MessageText:
105+//
106+// TaskSheduler Events
107+//
108+#define TASKSCHDULER_CATEGORY ((DWORD)0x00000011L)
109+
110+//
101111 // Message definitions.
102112 //
103113 //
@@ -143,7 +153,7 @@
143153 //
144154 // Thread, Hook and Timer Restarted.
145155 //
146-#define MSG_THREAD_HOOK_TIMER_RESTARTED ((DWORD)0x40000005L)
156+#define MSG_THREAD_HOOK_TIMER_RESTARTED ((DWORD)0x40000004L)
147157
148158 //
149159 // MessageId: MSG_QUIT_FLUSHMOUSE
@@ -152,7 +162,25 @@
152162 //
153163 // Quit FlushMouse.
154164 //
155-#define MSG_QUIT_FLUSHMOUSE ((DWORD)0x40000006L)
165+#define MSG_QUIT_FLUSHMOUSE ((DWORD)0x40000005L)
166+
167+//
168+// MessageId: MSG_RESTART_INSTALLER
169+//
170+// MessageText:
171+//
172+// Start FlushMouse(Installer).
173+//
174+#define MSG_RESTART_INSTALLER ((DWORD)0x00000006L)
175+
176+//
177+// MessageId: MSG_DONE_FLUSHMOUSE
178+//
179+// MessageText:
180+//
181+// Quit FlushMouse(Installer).
182+//
183+#define MSG_DONE_FLUSHMOUSE ((DWORD)0x00000007L)
156184
157185 //
158186 // MessageId: MSG_PBT_APMSUSPEND
--- a/FlushMouseDLL/EventlogData.mc
+++ b/FlushMouseDLL/EventlogData.mc
@@ -5,6 +5,7 @@
55 ;// -------+-----------+-----------+-------------------------------------------- -
66 ;// #0000 2023/04/13 JeffyTS New edit.
77 ;//
8+;//
89
910 SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
1011 Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
@@ -77,6 +78,16 @@ Language=Japanese
7778 PowerNotification Events
7879 .
7980
81+MessageId=0x11
82+SymbolicName=TASKSCHDULER_CATEGORY
83+Language=English
84+TaskSheduler Events
85+.
86+
87+Language=Japanese
88+TaskSheduler Events
89+.
90+
8091
8192 ;//
8293 ;// Message definitions.
@@ -130,7 +141,7 @@ Language=Japanese
130141 Thread, Hook and Timer Stopped.
131142 .
132143
133-MessageId=0x0005
144+MessageId=0x0004
134145 Severity=Informational
135146 Facility=Application
136147 SymbolicName=MSG_THREAD_HOOK_TIMER_RESTARTED
@@ -142,7 +153,7 @@ Language=Japanese
142153 Thread, Hook and Timer Restarted.
143154 .
144155
145-MessageId=0x0006
156+MessageId=0x0005
146157 Severity=Informational
147158 Facility=Application
148159 SymbolicName=MSG_QUIT_FLUSHMOUSE
@@ -154,6 +165,30 @@ Language=Japanese
154165 FlushMouseを終了します。
155166 .
156167
168+MessageId=0x0006
169+Severity=Success
170+Facility=Application
171+SymbolicName=MSG_RESTART_INSTALLER
172+Language=English
173+Start FlushMouse(Installer).
174+.
175+
176+Language=Japanese
177+FlushMouseを起動します(Installer)。
178+.
179+
180+MessageId=0x0007
181+Severity=Success
182+Facility=Application
183+SymbolicName=MSG_DONE_FLUSHMOUSE
184+Language=English
185+Quit FlushMouse(Installer).
186+.
187+
188+Language=Japanese
189+FlushMouseを終了します(Installer)。
190+.
191+
157192 MessageId=0x0100
158193 Severity=Informational
159194 Facility=Application
--- a/FlushMouseDLL/EventlogDll.h
+++ b/FlushMouseDLL/EventlogDll.h
@@ -12,6 +12,7 @@
1212 #pragma once
1313 #include "pch.h"
1414 #include "FlushMouseDll.h"
15+#include "EventlogData.h"
1516
1617 //
1718 // Global Prototype Define
--- a/FlushMouseDLL/GlobalHookDll.cpp
+++ b/FlushMouseDLL/GlobalHookDll.cpp
@@ -62,6 +62,12 @@ DLLEXPORT BOOL __stdcall bGlobalHookSet(HWND hWnd)
6262 }
6363 delete CSharedMem;
6464 CSharedMem = NULL;
65+ hGLInstance = NULL;
66+ hWndGLParent = NULL;
67+ hHookGL = NULL;
68+ lpDatGlobal = NULL;
69+ hPrevWnd = NULL;
70+ bSubclassed = FALSE;
6571 }
6672 return FALSE;
6773 }
@@ -86,6 +92,12 @@ DLLEXPORT BOOL __stdcall bGlobalHookUnset()
8692 }
8793 delete CSharedMem;
8894 CSharedMem = NULL;
95+ hGLInstance = NULL;
96+ hWndGLParent = NULL;
97+ hHookGL = NULL;
98+ lpDatGlobal = NULL;
99+ hPrevWnd = NULL;
100+ bSubclassed = FALSE;
89101 }
90102 return bRet;
91103 }
@@ -119,18 +131,20 @@ static LRESULT CALLBACK lpGlobalHookProc(int nCode, WPARAM wParam, LPARAM lParam
119131 if (lpCW->message == WM_HOOKEX) {
120132 if (bGlobalHookProcSub()) {
121133 if (lpCW->lParam) {
122- if (UnhookWindowsHookEx(hHookGL) != FALSE) {
123- if (!bSubclassed) {
134+ if (!bSubclassed) {
135+ if (hHookGL == NULL) break;
136+ if (UnhookWindowsHookEx(hHookGL) != FALSE) {
124137 #define DLLNAME _T("FlushMouseDLL.dll")
125138 if (LoadLibraryEx(DLLNAME, NULL, 0)) {
126139 bSubclassed = TRUE;
127140 }
141+ hHookGL = NULL;
128142 }
129143 }
130144 }
131145 else {
132- if (UnhookWindowsHookEx(hHookGL) != FALSE) {
133- FreeLibrary(hGLInstance);
146+ if (bSubclassed) {
147+ if (hHookGL == NULL) break;
134148 bSubclassed = FALSE;
135149 }
136150 }
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/KeyboardHookDll32.cpp
+++ b/FlushMouseDLL32/KeyboardHookDll32.cpp
@@ -23,8 +23,6 @@
2323 //
2424 static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lParam);
2525 static BOOL bKeyboardHookLLProcSub();
26-static BOOL bKBisNotJP();
27-static BOOL bKBisEP();
2826
2927 //
3028 // Local Data
@@ -62,6 +60,12 @@ DLLEXPORT BOOL __stdcall bKeyboardHookLLSet32(HWND hWnd)
6260 }
6361 delete CSharedMemLL;
6462 CSharedMemLL = NULL;
63+ bOnlyCtrlLL = FALSE;
64+ dwPreviousVKLL = 0;
65+ hWndKBParentLL = NULL;
66+ lpDatKeyboardLL = NULL;
67+ bEnableEPHelperLL = FALSE;
68+ bStartConvertingLL = FALSE;
6569 }
6670 return FALSE;
6771 }
@@ -82,6 +86,12 @@ DLLEXPORT BOOL __stdcall bKeyboardHookLLUnset32()
8286 }
8387 delete CSharedMemLL;
8488 CSharedMemLL = NULL;
89+ bOnlyCtrlLL = FALSE;
90+ dwPreviousVKLL = 0;
91+ hWndKBParentLL = NULL;
92+ lpDatKeyboardLL = NULL;
93+ bEnableEPHelperLL = FALSE;
94+ bStartConvertingLL = FALSE;
8595 }
8696 return bRet;
8797 }
@@ -158,7 +168,6 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
158168 case VK_F10: // (0x79)
159169 //case VK_NUMLOCK: // Num Lock (0x90)
160170 case VK_OEM_ATTN: // OEM 英数/CapsLock (0xf0)
161- case VK_OEM_FINISH: // OEM カタカナ (0xf1)
162171 case VK_OEM_COPY: // OEM ひらがな (0xf2)
163172 //case VK_OEM_AUTO: // OEM 半角/全角 (0xf3 = VK_OEM_IME_OFF)
164173 case VK_OEM_IME_OFF: // OEM IME OFF (0xf3)
@@ -170,11 +179,21 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
170179 PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
171180 }
172181 break;
173- case 0xff: // US(ENG) Convert (0xff)
182+ case VK_OEM_FINISH: // OEM カタカナ (0xf1)
183+ bOnlyCtrlLL = FALSE;
184+ if (GetAsyncKeyState(VK_SHIFT) & 0x8000) { // Remove Shift + Caps Lock
185+ if (bKeyboardHookLLProcSub()) {
186+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
187+ return 1;
188+ }
189+ }
190+ break;
191+ case VK_FF: // US(ENG) Convert (0xff)
174192 if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
175193 if (bKeyboardHookLLProcSub()) {
176194 if (!bEnableEPHelperLL) break;
177195 PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_FINISH, ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
196+ return 1;
178197 }
179198 }
180199 else if (lpstKBH->scanCode == 0x0070) {
@@ -216,34 +235,34 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
216235 case VK_CAPITAL: // 英数/CapsLock (0x14)
217236 bOnlyCtrlLL = FALSE;
218237 bStartConvertingLL = FALSE;
219- if (bKBisNotJP() || bKBisEP()) {
220- dwPreviousVKLL = VK_OEM_ATTN;
221- if (bKeyboardHookLLProcSub()) {
222- if (!bEnableEPHelperLL) break;
223- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_ATTN, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
224- }
225- return 1;
238+ dwPreviousVKLL = VK_OEM_ATTN;
239+ if (bKeyboardHookLLProcSub()) {
240+ if (!bEnableEPHelperLL) break;
241+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_ATTN, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
226242 }
243+ return 1;
227244 break;
228245 case VK_KANJI: // JP(IME/ENG) Alt + 漢字 (0x19)
229246 bOnlyCtrlLL = FALSE;
230247 bStartConvertingLL = FALSE;
231248 dwPreviousVKLL = VK_KANJI;
232- if (bKeyboardHookLLProcSub()) {
233- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_KANJI, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
249+ if (GetAsyncKeyState(VK_MENU) & 0x8000) {
250+ if (bKeyboardHookLLProcSub()) {
251+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_KANJI, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
252+ }
253+ return 1;
234254 }
235255 break;
236256 case VK_OEM_3: // JP(IME/ENG) [@] / US(ENG) IME ON (0xc0) = ['] ALT + 半角/全角 or 漢字
237257 case VK_OEM_8: // JP(IME/ENG) [`] / UK(ENG) IME ON (0xdf) = ['] ALT + 半角/全角 or 漢字
238258 bOnlyCtrlLL = FALSE;
239259 bStartConvertingLL = FALSE;
240- if (bKBisNotJP() || bKBisEP()) {
241- if (bKeyboardHookLLProcSub()) {
242- if (!bEnableEPHelperLL) break;
243- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
244- }
245- return 1;
260+ if (bKeyboardHookLLProcSub()) {
261+ PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (WM_USER + lpstKBH->vkCode));
262+ if (!bEnableEPHelperLL) break;
263+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
246264 }
265+ return 1;
247266 break;
248267 case VK_OEM_ATTN: // OEM 英数/CapsLock (0xf0)
249268 case VK_OEM_FINISH: // OEM カタカナ (0xf1)
@@ -256,6 +275,7 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
256275 break;
257276 case VK_RETURN: // RETURN (0x0d)
258277 case VK_ESCAPE: // ESC (0x1b)
278+ case VK_NONCONVERT: // 無変換 (0x1d)
259279 case VK_INSERT: // INSERT (0x2d)
260280 bOnlyCtrlLL = FALSE;
261281 bStartConvertingLL = FALSE;
@@ -287,34 +307,6 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
287307 }
288308
289309 //
290-// bKBisNotJP()
291-//
292-static BOOL bKBisNotJP()
293-{
294-#define KB_MASK 0xffff0000
295-#define KB_JP 0x04110000
296-
297- DWORD dProcessID = 0;
298- DWORD dThreadID = GetWindowThreadProcessId(GetForegroundWindow(), &dProcessID);
299- HKL hkl = GetKeyboardLayout(dThreadID);
300- if (((UINT64)hkl & KB_MASK) != KB_JP) {
301- return TRUE;
302- }
303- return FALSE;
304-}
305-
306-//
307-// bKBisEP()
308-//
309-static BOOL bKBisEP()
310-{
311- if (GetKeyboardType(1) == 0) {
312- return TRUE;
313- }
314- return FALSE;
315-}
316-
317-//
318310 // bKeyboardHookLLProcSub
319311 //
320312 static BOOL bKeyboardHookLLProcSub()
--- a/FlushMouseDLL32/MouseHookDll32.cpp
+++ b/FlushMouseDLL32/MouseHookDll32.cpp
@@ -55,6 +55,8 @@ DLLEXPORT BOOL __stdcall bMouseHookSet32(HWND hWnd)
5555 }
5656 delete CSharedMem;
5757 CSharedMem = NULL;
58+ hWndMSParent = NULL;
59+ lpDatMouse = NULL;
5860 }
5961 return FALSE;
6062 }
@@ -75,6 +77,8 @@ DLLEXPORT BOOL __stdcall bMouseHookUnset32()
7577 }
7678 delete CSharedMem;
7779 CSharedMem = NULL;
80+ hWndMSParent = NULL;
81+ lpDatMouse = NULL;
7882 }
7983 return bRet;
8084 }
Binary files /dev/null and b/FlushMouse_x64.msi differ
--- a/MiscLIB/CRegistry.cpp
+++ b/MiscLIB/CRegistry.cpp
@@ -40,7 +40,7 @@ BOOL CRegistry::bGetSetRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szV
4040 DWORD dwDisposition = 0;
4141 DWORD dwLen = sizeof(DWORD);
4242 DWORD dwData = dwInitialData;
43- if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
43+ if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WOW64_64KEY, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
4444 if (dwDisposition == KEY_QUERY_VALUE) {
4545 if ((lStatus = RegSetValueEx(hKeySub, szValue, NULL, REG_DWORD, reinterpret_cast<BYTE*>(&dwData), dwLen)) == ERROR_SUCCESS) {
4646 bRet = TRUE;
@@ -72,8 +72,33 @@ BOOL CRegistry::bReadRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szVal
7272 BOOL bRet = FALSE;
7373 DWORD dwData = 0;
7474 DWORD dwLen = sizeof(DWORD);
75- if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS) {
76- if ((lStatus = RegGetValue(hKey, lpszSubKey, szValue, RRF_RT_REG_DWORD, NULL, &dwData, &dwLen)) == ERROR_SUCCESS) {
75+ if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hkResult)) == ERROR_SUCCESS) {
76+ if ((lStatus = RegGetValue(hKey, lpszSubKey, szValue, RRF_RT_REG_DWORD | RRF_SUBKEY_WOW6464KEY, NULL, &dwData, &dwLen)) == ERROR_SUCCESS) {
77+ bRet = TRUE;
78+ }
79+ else {
80+ if (lStatus == ERROR_FILE_NOT_FOUND) {
81+ bRet = FALSE;
82+ }
83+ }
84+ RegCloseKey(hkResult);
85+ }
86+ *lpdwData = dwData;
87+ return bRet;
88+}
89+
90+//
91+// bReadSystemRegValueDWORD()
92+//
93+BOOL CRegistry::bReadSystemRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPDWORD lpdwData)
94+{
95+ LSTATUS lStatus = 0;
96+ HKEY hkResult = 0;
97+ BOOL bRet = FALSE;
98+ DWORD dwData = 0;
99+ DWORD dwLen = sizeof(DWORD);
100+ if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hkResult)) == ERROR_SUCCESS) {
101+ if ((lStatus = RegGetValue(hKey, lpszSubKey, szValue, RRF_RT_REG_DWORD | RRF_SUBKEY_WOW6464KEY, NULL, &dwData, &dwLen)) == ERROR_SUCCESS) {
77102 bRet = TRUE;
78103 }
79104 else {
@@ -96,7 +121,7 @@ BOOL CRegistry::bSetRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValu
96121 HKEY hKeySub = NULL;
97122 BOOL bRet = FALSE;
98123 DWORD dwDisposition = 0;
99- if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
124+ if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WOW64_64KEY, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
100125 DWORD dwLen = sizeof(DWORD);
101126 if ((lStatus = RegSetValueEx(hKeySub, szValue, NULL, REG_DWORD, reinterpret_cast<BYTE*>(&dwData), dwLen)) == ERROR_SUCCESS) {
102127 bRet = TRUE;
@@ -149,7 +174,7 @@ BOOL CRegistry::bReadRegValueString(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szVa
149174 LSTATUS lStatus = 0;
150175 HKEY hKeySub = NULL;
151176 BOOL bRet = FALSE;
152- if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ, &hKeySub)) == ERROR_SUCCESS) {
177+ if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hKeySub)) == ERROR_SUCCESS) {
153178 DWORD dwLen = 0;
154179 if ((lStatus = RegQueryValueEx(hKeySub, szValue, NULL, NULL, NULL, &dwLen)) == ERROR_SUCCESS) {
155180 if ((dwLen <= (_MAX_PATH * sizeof(TCHAR)) && (dwLen <= dwDataSize))) {
@@ -172,7 +197,7 @@ BOOL CRegistry::bGetSetRegValueString(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR sz
172197 LSTATUS lStatus = 0;
173198 HKEY hKeySub = NULL;
174199 BOOL bRet = FALSE;
175- if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ, &hKeySub)) == ERROR_SUCCESS) {
200+ if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hKeySub)) == ERROR_SUCCESS) {
176201 DWORD dwLen = 0;
177202 if ((lStatus = RegQueryValueEx(hKeySub, szValue, NULL, NULL, NULL, &dwLen)) == ERROR_SUCCESS) {
178203 if ((dwLen <= (_MAX_PATH * sizeof(TCHAR)) && (dwLen <= dwDataSize))) {
@@ -196,7 +221,7 @@ BOOL CRegistry::bSetRegValueString(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szVal
196221 HKEY hKeySub = NULL;
197222 BOOL bRet = FALSE;
198223 DWORD dwDisposition = 0;
199- if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
224+ if ((lStatus = RegCreateKeyEx(hKey, lpszSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WOW64_64KEY, NULL, &hKeySub, &dwDisposition)) == ERROR_SUCCESS) {
200225 if (dwDataSize <= _MAX_PATH) {
201226 if ((lStatus = RegSetValueEx(hKeySub, szValue, NULL, REG_SZ, (LPBYTE)&szData, dwDataSize)) == ERROR_SUCCESS) {
202227 bRet = TRUE;
@@ -215,7 +240,7 @@ BOOL CRegistry::bDeleteRegValue(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue)
215240 LSTATUS lStatus = 0;
216241 HKEY hKeySub = NULL;
217242 BOOL bRet = FALSE;
218- if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_ALL_ACCESS, &hKeySub)) == ERROR_SUCCESS) {
243+ if ((lStatus = RegOpenKeyEx(hKey, lpszSubKey, 0, KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hKeySub)) == ERROR_SUCCESS) {
219244 if ((lStatus = RegDeleteValue(hKeySub, szValue)) == ERROR_SUCCESS) {
220245 bRet = TRUE;
221246 }
--- a/MiscLIB/CRegistry.h
+++ b/MiscLIB/CRegistry.h
@@ -30,6 +30,7 @@ public:
3030 BOOL bSetRegValueString(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPTSTR szData, DWORD dwDataSize);
3131
3232 BOOL bReadRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPDWORD lpdwData);
33+ BOOL bReadSystemRegValueDWORD(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPDWORD lpdwData);
3334 BOOL bReadRegValueDWORDasBOOL(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPBOOL lpbData);
3435 BOOL bReadRegValueString(HKEY hKey, LPCTSTR lpszSubKey, LPCTSTR szValue, LPTSTR szData, DWORD dwDataSize);
3536
--- a/MiscLIB/CSharedMemory.cpp
+++ b/MiscLIB/CSharedMemory.cpp
@@ -33,7 +33,7 @@ CSharedMemory::CSharedMemory(LPCTSTR szSharedMemoryName, DWORD dwDataSize)
3333 {
3434
3535 size_t size = wcsnlen_s(szSharedMemoryName, MAX_LOADSTRING);
36- lpszSharedMemoryName = new TCHAR[size + 1];
36+ if ((lpszSharedMemoryName = new TCHAR[size + 1]) == NULL) return;
3737 ZeroMemory(lpszSharedMemoryName, sizeof(TCHAR) * (size + 1));
3838 _tcsncpy_s(lpszSharedMemoryName, size + 1, szSharedMemoryName, _TRUNCATE);
3939 dwDataByteSize = dwDataSize;
@@ -65,7 +65,7 @@ CSharedMemory::~CSharedMemory()
6565 hSharedMem = NULL;
6666 }
6767 }
68- delete[] lpszSharedMemoryName;
68+ if (lpszSharedMemoryName != NULL) delete[] lpszSharedMemoryName;
6969 lpszSharedMemoryName = NULL;
7070 dwDataByteSize = 0;
7171 return;
--- a/MiscLIB/CThread.cpp
+++ b/MiscLIB/CThread.cpp
@@ -12,14 +12,12 @@
1212 #include "CThread.h"
1313
1414 //
15-// CThred::
15+// CThread::
1616 //
1717 CThread::CThread()
1818 {
19- lpstThreadData = new THREAD_DATA[sizeof(THREAD_DATA)];
20- ZeroMemory(lpstThreadData, sizeof(THREAD_DATA));
21- lpstThreadData->lpstSA = new SECURITY_ATTRIBUTES[sizeof(SECURITY_ATTRIBUTES)];
22- ZeroMemory(lpstThreadData->lpstSA, sizeof(SECURITY_ATTRIBUTES));
19+ if ((lpstThreadData = new THREAD_DATA[sizeof(THREAD_DATA)]) != NULL) ZeroMemory(lpstThreadData, sizeof(THREAD_DATA));
20+ if ((lpstThreadData->lpstSA = new SECURITY_ATTRIBUTES[sizeof(SECURITY_ATTRIBUTES)]) != NULL) ZeroMemory(lpstThreadData->lpstSA, sizeof(SECURITY_ATTRIBUTES));
2321
2422 lpstThreadData->lpstSA->nLength = sizeof(SECURITY_ATTRIBUTES);
2523 lpstThreadData->lpstSA->lpSecurityDescriptor = NULL;
@@ -39,7 +37,7 @@ CThread::~CThread()
3937 //
4038 BOOL CThread::bRegister(LPCTSTR lpszThreadName, DWORD dwThreadID, LPTHREAD_START_ROUTINE lpbCallbackRoutine, LPVOID lParamOption, DWORD dwSleepTime)
4139 {
42- if (lpstThreadData == NULL) return FALSE;
40+ if ((lpstThreadData == NULL) || (lpstThreadData->lpstSA == NULL)) return FALSE;
4341 lpstThreadData->lpszThreadName = lpszThreadName; lpstThreadData->dwThreadID = dwThreadID;
4442 lpstThreadData->lpbCallbackRoutine = lpbCallbackRoutine; lpstThreadData->lParamOption = lParamOption;
4543 lpstThreadData->dwSleepTime = dwSleepTime; lpstThreadData->bThreadSentinel = TRUE;
@@ -57,9 +55,7 @@ BOOL CThread::bRegister(LPCTSTR lpszThreadName, DWORD dwThreadID, LPTHREAD_STAR
5755 //
5856 BOOL CThread::bStart()
5957 {
60- if ((lpstThreadData == NULL) || (lpstThreadData->hThread == NULL)) {
61- return FALSE;
62- }
58+ if ((lpstThreadData == NULL) || (lpstThreadData->lpstSA == NULL) || (lpstThreadData->hThread == NULL)) return FALSE;
6359 lpstThreadData->bThreadSentinel = TRUE;
6460 DWORD dwExitCode = 0;
6561 if (GetExitCodeThread((HANDLE)lpstThreadData->hThread, &dwExitCode)) {
@@ -89,29 +85,27 @@ BOOL CThread::bStart()
8985 VOID CThread::vUnregister()
9086 {
9187 #define TIMEOUT 1000
92- if ((lpstThreadData == NULL) || (lpstThreadData->hThread == NULL)) return;
88+ if ((lpstThreadData == NULL) || (lpstThreadData->lpstSA == NULL) || (lpstThreadData->hEvent == NULL) || (lpstThreadData->hThread == NULL)) return;
9389 lpstThreadData->bThreadSentinel = FALSE;
9490 DWORD dwExitCode = 0;
9591 if (GetExitCodeThread((HANDLE)lpstThreadData->hThread, &dwExitCode)) {
9692 if (dwExitCode == STILL_ACTIVE) {
9793 if (ResumeThread(lpstThreadData->hThread) != -1) {
98- if (lpstThreadData->hEvent != NULL) {
99- if (SetEvent(lpstThreadData->hEvent)) {
100- DWORD dwRet = WaitForSingleObject((HANDLE)lpstThreadData->hThread, TIMEOUT);
101- switch (dwRet) {
102- case WAIT_OBJECT_0:
103- break;
104- case WAIT_ABANDONED:
105- case WAIT_TIMEOUT:
106- case WAIT_FAILED:
107- default:
94+ if (SetEvent(lpstThreadData->hEvent)) {
95+ DWORD dwRet = WaitForSingleObject((HANDLE)lpstThreadData->hThread, TIMEOUT);
96+ switch (dwRet) {
97+ case WAIT_OBJECT_0:
98+ break;
99+ case WAIT_ABANDONED:
100+ case WAIT_TIMEOUT:
101+ case WAIT_FAILED:
102+ default:
108103 #pragma warning(push)
109104 #pragma warning(disable : 6258)
110105 if (!TerminateThread(lpstThreadData->hThread, 2)) {
111106 }
112107 #pragma warning(pop)
113108 break;
114- }
115109 }
116110 }
117111 }
@@ -129,7 +123,7 @@ unsigned __stdcall CThread::uThreadProc(void* pArguments)
129123 {
130124 LPTHREAD_DATA lpstThreadData = (LPTHREAD_DATA)pArguments;
131125 do {
132- if ((lpstThreadData != NULL) && (lpstThreadData->hEvent != NULL) && (lpstThreadData->hThread != NULL)) {
126+ if ((lpstThreadData != NULL) && (lpstThreadData->lpstSA != NULL) && (lpstThreadData->hEvent != NULL) && (lpstThreadData->hThread != NULL)) {
133127 DWORD dwRet = WaitForSingleObject(lpstThreadData->hEvent, INFINITE);
134128 switch (dwRet) {
135129 case WAIT_OBJECT_0:
--- a/OSDN Wiki/osdn.txt
+++ b/OSDN Wiki/osdn.txt
@@ -2,22 +2,24 @@
22
33 [[RepositoryInfo]]
44
5-||[[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 ChatGPT)'''||
5+||[[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/05/25[[BR]]
9-   Version 0.9.4.14 をリリースしました[[BR]]
8+2023/06/13[[BR]]
9+   '''Version 1.0.0.1 をリリースしました'''[[BR]]
1010 [[BR]]
1111 (主な変更点)[[BR]]
12- * 処理のシェイプアップ及び軽微なバグ修正を行いました[[BR]]
12+ * 処理のシェイプアップ及びバグ修正を行いました[[BR]]
1313 * IMEモードの表示の色指定でαチャネルが有効になるようにしてあります(設定画面は作成していません。レジストリを編集できる方は好みの色にしてみてください。ただし、レジストリの編集は十分注意して行ってください)[[BR]]
1414 * HKEY_CURRENT_USER\Software\JeffyTS\FlushMouse の NearDrawCaretColor と NearDrawMouseColor です。上位バイトから、α B G R の順です[[BR]]
1515 * αの値は、通常と違って、大きいほうが透明度が高くなります。これは従来と互換性を持たせるためですのでご了承ください。なお、レジストリを変更した方がいたら、お手数をおかけしますが修正をお願いします[[BR]]
1616 * マウスカーソル右下のモード表示の色は、現状では変更できません。ご了承ください[[BR]]
1717 [[BR]]
1818 (今後について)[[BR]]
19- * OSDN上ではここまでの機能で開発は終了としたいと考えています(バグ対応は除く)[[BR]]
20- * 今後は、プレゼンテーションモードの追加や、マウスカーソルの形状や、表示する内容などをカスタマイズする機能をつけて有償に移行しようと考えています[[BR]]
19+ * ~~OSDN上ではここまでの機能で開発は終了としたいと考えています(バグ対応は除く)~~[[BR]]
20+ * ~~今後は、プレゼンテーションモードの追加や、マウスカーソルの形状や、表示する内容などをカスタマイズする機能をつけて有償に移行しようと考えています~~[[BR]]
21+ * と、上記のように考えていたのですが、この FlushMouse は Microsoft Storeに登録できないやり方を使って処理しているので無理なことが判明しました(フックを使用しいるとどうしてもだめなようです。ただ、SDKなどでだいぶ検証して直させてもらいました)[[BR]]
22+ * '''ということで、今後も暇を見つけて、機能向上を目指していきますのでよろしくお願いします'''[[BR]]
2123 [[BR]]
2224 ||'''対応OS'''||
2325 Windows 10 / 11 64bit (Latest Release Versionで検証しています)[[BR]]
--- a/SetupProject/Product.wxs
+++ b/SetupProject/Product.wxs
@@ -32,14 +32,18 @@
3232 Description="$(var.Description)"
3333 Comments="$(var.Comments)"
3434 Manufacturer="$(var.Manufacturer)" />
35+
3536 <!-- @@@ for Major Upgrade -->
37+ <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="[ProductName] の新しいバージョンがすでにインストールされています。" />
38+ <!-- @@@ for Upgrade -->
39+ <Property Id='PREVIOUSVERSIONSINSTALLED' Secure='yes' />
3640 <Upgrade Id="{8B8C6810-E467-498D-926C-F4139B2AE8AB}">
37- <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
38- Minimum='$(var.Version)' IncludeMinimum='no' />
39- <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
40- Minimum='0.3.0' IncludeMinimum='yes'
41- Maximum='$(var.Version)' IncludeMaximum='no' />
41+ <!--UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum='$(var.Version)' IncludeMinimum='no' /-->
42+ <UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND' Minimum='0.0.0.0' IncludeMinimum='yes' Maximum='$(var.Version)' IncludeMaximum='no' />
43+ <UpgradeVersion OnlyDetect='yes' Property='SELFFOUND' Minimum='0.0.0.0' IncludeMinimum='yes' Maximum='$(var.Version)' IncludeMaximum='yes' />
44+ <UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum='$(var.Version)' IncludeMinimum='no' />
4245 </Upgrade>
46+
4347 <!-- Media Template-->
4448 <MediaTemplate EmbedCab="yes" />
4549
@@ -72,89 +76,129 @@
7276 <!-- Condition -->
7377 <Condition Message="Windows 10 Anniversary update 以降が必要です"> WindowsBuild &lt; 14390 </Condition>
7478 <Condition Message="64bitのWindows 10 Anniversary update 以降が必要です"> NOT (%PROCESSOR_ARCHITECTURE="x86") </Condition>
75- <!-- Verify Dialog for Short cut & Start menu -->
79+ <!-- Verify Dialog for Short cut , Start menu & application Launch menu -->
7680 <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT1" Value=" デスクトップにショートカットを作成する" />
7781 <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX1" Value="1" />
7882 <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT2" Value=" スタートメニューに登録する" />
83+ <!--Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX2" Value="1" /-->
84+ <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3" Value=" セットアップを終了したら、すぐに $(var.ProductName) を実行する" />
85+ <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3" Value="1" />
86+ <!-- Exit Dialog for application Launch -->
7987 <!-- Comment out for default Check box off Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX2" Value="2" /-->
8088 <!--Property Id="WIXUI_VERIFYDIALOGOPTIONALCOMMENT1" Value=" セットアップが完了したら再起動してください" /-->
8189 <!-- Verify Dialog for Uninstall Registry -->
82- <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3" Value=" $(var.ProductName) の設定情報を削除する" />
90+ <Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT4" Value=" $(var.ProductName) の設定情報を削除する" />
91+ <!--Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX4" Value="1" /-->
8392 <!-- Comment out for default Check box off Property Id="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3" Value="1" /-->
8493 <!-- Exit Dialog for application Launch -->
85- <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value=" セットアップを終了したら、すぐに $(var.ProductName) を実行する  (ただし、全機能を使用するためにはWindowsの再起動が必要です)" />
86- <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
94+ <!--Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value=" セットアップを終了したら、すぐに $(var.ProductName) を実行する  (ただし、全機能を使用するためにはWindowsの再起動が必要です)" />
95+ <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" /-->
8796
8897 <UI>
8998 <!-- WixUtilExtension が必要 -->
9099 <!-- Majour Upgrade Dialog-->
91100 <Dialog Id="NewerFoundDlg" Width="270" Height="105" Title="[ProductName] セットアップ" NoMinimize="yes">
92- <Control Id="MessageText" Type="Text"
93- X="48" Y="15" Width="205" Height="60" TabSkip="no"
94- Text="[ProductName] の新しいバージョンがすでにインストールされています。" />
95- <Control Id="Y" Type="PushButton"
96- X="200" Y="80" Width="56" Height="17" TabSkip="yes"
97- Text="!(loc.WixUIOK)">
101+ <Control Id="MessageText" Type="Text" X="48" Y="15" Width="205" Height="60" TabSkip="no" Text="[ProductName] の新しいバージョンがすでにインストールされています。" />
102+ <Control Id="Y" Type="PushButton" X="200" Y="80" Width="56" Height="17" TabSkip="yes" Text="!(loc.WixUIOK)">
103+ <Publish Event="EndDialog" Value="Return">1</Publish>
104+ </Control>
105+ <Control Id="NewerFoundDlgIcon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.ErrorDlgErrorIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.ErrorDlgErrorIcon)" />
106+ </Dialog>
107+ <Dialog Id="SelfFoundDlg" Width="270" Height="105" Title="[ProductName] セットアップ" NoMinimize="yes">
108+ <Control Id="MessageText" Type="Text" X="48" Y="15" Width="205" Height="60" TabSkip="no" Text="[ProductName] の同じバージョンがすでにインストールされています。" />
109+ <Control Id="Y" Type="PushButton" X="200" Y="80" Width="56" Height="17" TabSkip="yes" Text="!(loc.WixUIOK)">
98110 <Publish Event="EndDialog" Value="Return">1</Publish>
99111 </Control>
100- <Control Id="NewerFoundDlgIcon"
101- Type="Icon" X="15" Y="15" Width="24" Height="24"
102- ToolTip="!(loc.ErrorDlgErrorIconTooltip)" FixedSize="yes" IconSize="32"
103- Text="!(loc.ErrorDlgErrorIcon)" />
112+ <Control Id="SeelfFoundDlgIcon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.ErrorDlgErrorIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.ErrorDlgErrorIcon)" />
104113 </Dialog>
114+ <!-- _VerifyReady Dialog for Launch application -->
115+ <!--Publish Dialog="_ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3 = 1 and NOT Installed</Publish-->
105116 <!-- _VerifyReady Dialog for remove registry, but publish on _ExitDlg-->
106- <Publish Dialog="_ExitDialog" Control="Finish" Event="DoAction" Value="RemoveReg">WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3 = 1 and Installed</Publish>
117+ <Publish Dialog="_ExitDialog" Control="Finish" Event="DoAction" Value="RemoveReg">WIXUI_VERIFYDIALOGOPTIONALCHECKBOX4 = 1 and Installed</Publish>
107118 <!-- _Exit Dialog for Launch application -->
108- <Publish Dialog="_ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
119+ <!--Publish Dialog="_ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish-->
109120 </UI>
110121 <!-- Newer Version Found -->
111122 <InstallUISequence>
112123 <Show Dialog='NewerFoundDlg' After='FindRelatedProducts'>NEWERFOUND</Show>
113- <Custom Action='WixExitEarlyWithSuccess' After='NewerFoundDlg'>NEWERFOUND</Custom>
124+ <Show Dialog='SelfFoundDlg' After='FindRelatedProducts'>SELFFOUND</Show>
114125 </InstallUISequence>
115126 <InstallExecuteSequence>
116- <Custom Action='WixExitEarlyWithSuccess' After='FindRelatedProducts'>NEWERFOUND</Custom>
117- <RemoveExistingProducts After="InstallFinalize" />
118- </InstallExecuteSequence>
119- <!--CustomAction Id='AlreadyUpdated' Error='[ProductName] は既に、このバージョンに更新されています。' /-->
120- <!--CustomAction Id='NoDowngrade' Error='[ProductName] の新しいバージョンが既にインストールされています。' /-->
121- <InstallExecuteSequence>
122- <Custom Action="TaskKill" Before="FindRelatedProducts">Installed</Custom>
127+ <Custom Action="QuitApplication" Before="FindRelatedProducts"></Custom>
128+ <!--Custom Action='WixExitEarlyWithSuccess' After='NewerFoundDlg'>NEWERFOUND</Custom-->
129+ <!--Custom Action='WixExitEarlyWithSuccess' After='SelfFoundDlg'>SELFFOUND</Custom-->
130+ <!--Custom Action='WixExitEarlyWithSuccess' After='FindRelatedProducts'>NEWERFOUND</Custom-->
131+ <Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
132+ <Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERFOUND</Custom>
133+ <!--RemoveExistingProducts After="InstallFinalize" /-->
134+ <!--Custom Action="TaskKill" After="FindRelatedProducts">Installed</Custom-->
135+ <Custom Action="QuitApplication2" After="InstallInitialize">Installed</Custom>
136+ <!--Custom Action='QuitApplication4' After='InstallInitialize'>Installed</Custom-->
123137 <Custom Action='UnregisterTaskScheduler' After='InstallInitialize'>Installed</Custom>
124- <Custom Action='UnregisterEventlog' After='InstallInitialize'>Installed</Custom>
125- <Custom Action='TaskKill_force' After='InstallInitialize'>Installed</Custom>
126- <Custom Action='RegisterTaskScheduler' Before='InstallFinalize'>NOT Installed</Custom>
127- <Custom Action='RegisterEventlog' Before='InstallFinalize'>NOT Installed</Custom>
128- <Custom Action='RemoveReg' After='RemoveExistingProducts'>WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3 = 1 and Installed</Custom>
138+ <Custom Action='UnregisterTaskScheduler2' After='InstallInitialize'>Installed</Custom>
139+ <!--Custom Action='UnregisterEventlog' After='InstallInitialize'>Installed</Custom-->
140+ <!--Custom Action="QuitApplication" After="InstallInitialize">Installed</Custom-->
141+ <!--Custom Action="TaskKill" After="InstallInitialize">Installed</Custom-->
142+ <!--Custom Action='TaskKill_force' After='InstallInitialize'>Installed</Custom-->
143+
144+ <Custom Action='RegisterTaskScheduler' Before='InstallFinalize'>(NOT Installed) or REINSTALL</Custom>
145+ <Custom Action='RegisterTaskScheduler2' Before='InstallFinalize'>(NOT Installed) or REINSTALL</Custom>
146+ <Custom Action='LaunchApplication' After='InstallFinalize'>(WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3 = 1 and NOT Installed) or (WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3 = 1 and REINSTALL)</Custom>
147+ <!--Custom Action='LaunchApplication' Before='InstallFinalize'>NOT Installed</Custom-->
148+ <!--Custom Action='RegisterEventlog' Before='InstallFinalize'>NOT Installed</Custom-->
149+
150+ <!--Custom Action="QuitApplication3" Before="RemoveExistingProducts">Installed</Custom-->
151+ <Custom Action='RemoveReg' After='RemoveExistingProducts'>WIXUI_VERIFYDIALOGOPTIONALCHECKBOX4 = 1 and Installed</Custom>
129152 </InstallExecuteSequence>
130153
154+ <!-- Version Check -->
155+ <CustomAction Id='AlreadyUpdated' Error='[ProductName] は既に、このバージョンに更新されています。' />
156+ <CustomAction Id='NoDowngrade' Error='[ProductName] の新しいバージョンが既にインストールされています。' />
131157 <!-- Kill Own Application -->
132158 <Binary Id="TASKKILL" SourceFile="C:\Windows\System32\taskkill.exe"> </Binary>
133- <CustomAction Id="TaskKill" BinaryKey="TASKKILL" Execute="immediate" Return="ignore" Impersonate="yes"
159+ <CustomAction Id="TaskKill" BinaryKey="TASKKILL" Execute="deferred" Return="ignore" Impersonate="no"
134160 ExeCommand=" /IM &quot;$(var.MainExeFileName)&quot;" />
135161 <CustomAction Id="TaskKill_force" BinaryKey="TASKKILL" Execute="deferred" Return="asyncWait" Impersonate="no"
136162 ExeCommand=" /F /IM &quot;$(var.MainExeFileName)&quot; /IM &quot;$(var.ProductName)32.exe&quot;" />
137- <!-- Application Launch on Exit Dialog -->
138- <CustomAction Id="LaunchApplication" Directory="INSTALLFOLDER"
139- ExeCommand="[INSTALLFOLDER]$(var.MainExeFileName)" Return="asyncNoWait" />
163+ <!-- Quit Own Application -->
164+ <Binary Id="EVENTCREATE" SourceFile="C:\Windows\System32\eventcreate.exe"> </Binary>
165+ <CustomAction Id="QuitApplication" BinaryKey="EVENTCREATE" Execute="firstSequence" Return="ignore" Impersonate="yes"
166+ ExeCommand=" /T SUCCESS /ID 7 /L Application /SO FlushMouse /D &quot;Quit FlushMouse(Installer).&quot;" />
167+ <CustomAction Id="QuitApplication2" BinaryKey="EVENTCREATE" Execute="firstSequence" Return="ignore" Impersonate="yes"
168+ ExeCommand=" /T SUCCESS /ID 7 /L Application /SO FlushMouse /D &quot;Quit FlushMouse(Installer).&quot;" />
169+ <CustomAction Id="QuitApplication3" BinaryKey="EVENTCREATE" Execute="firstSequence" Return="ignore" Impersonate="yes"
170+ ExeCommand=" /T SUCCESS /ID 7 /L Application /SO FlushMouse /D &quot;Quit FlushMouse(Installer).&quot;" />
171+ <!--Binary Id="QUITApplication" SourceFile="C:\Program Files\JeffyTS\FlushMouse\FlushMouse.exe"> </Binary>
172+ <CustomAction Id="QuitApplication4" BinaryKey="QUITApplication" Execute="deferred" Return="ignore" Impersonate="no"
173+ ExeCommand=" /quit" /-->
174+ <!-- Application Launch -->
175+ <!--CustomAction Id="LaunchApplication" Directory="INSTALLFOLDER"
176+ ExeCommand="[INSTALLFOLDER]$(var.MainExeFileName)" Return="asyncNoWait" /-->
177+ <CustomAction Id="LaunchApplication" BinaryKey="EVENTCREATE" Execute="immediate" Return="ignore" Impersonate="yes"
178+ ExeCommand=" /T SUCCESS /ID 6 /L Application /SO FlushMouse /D &quot;Start FlushMouse(Installer).&quot;" />
179+
140180 <!-- Register TaskScheduler -->
141181 <Binary Id="REGISTERTaskScheduler" SourceFile="C:\Windows\System32\schtasks.exe"> </Binary>
142182 <CustomAction Id="RegisterTaskScheduler" BinaryKey="REGISTERTaskScheduler" Execute="deferred" Return="asyncWait" Impersonate="no"
143183 ExeCommand=" /Create /F /TN &quot;$(var.ProductName)&quot; /XML &quot;[INSTALLFOLDER]Register_TaskScheduler.xml&quot;" />
184+ <CustomAction Id="RegisterTaskScheduler2" BinaryKey="REGISTERTaskScheduler" Execute="deferred" Return="asyncWait" Impersonate="no"
185+ ExeCommand=" /Create /F /TN &quot;$(var.ProductName)Installer&quot; /XML &quot;[INSTALLFOLDER]Register_TaskScheduler2.xml&quot;" />
144186 <!-- Unregister TaskScheduler -->
145187 <Binary Id="UNREGISTERTaskScheduler" SourceFile="C:\Windows\System32\schtasks.exe"> </Binary>
146188 <CustomAction Id="UnregisterTaskScheduler" BinaryKey="UNREGISTERTaskScheduler" Execute="deferred" Return="asyncWait" Impersonate="no"
147189 ExeCommand=" /Delete /F /TN &quot;$(var.ProductName)&quot;" />
190+ <CustomAction Id="UnregisterTaskScheduler2" BinaryKey="UNREGISTERTaskScheduler" Execute="deferred" Return="asyncWait" Impersonate="no"
191+ ExeCommand=" /Delete /F /TN &quot;$(var.ProductName)Installer&quot;" />
148192 <!-- Register EventLog -->
149- <Binary Id="REGISTEREventlog" SourceFile="C:\Windows\System32\reg.exe"> </Binary>
193+ <!--Binary Id="REGISTEREventlog" SourceFile="C:\Windows\System32\reg.exe"> </Binary>
150194 <CustomAction Id="RegisterEventlog" BinaryKey="REGISTEREventlog" Execute="deferred" Return="asyncWait" Impersonate="no"
151- ExeCommand=" IMPORT &quot;[INSTALLFOLDER]Register_Eventlog.reg&quot; /reg:64" />
195+ ExeCommand=" IMPORT &quot;[INSTALLFOLDER]Register_Eventlog.reg&quot; /reg:64" /-->
152196 <!-- Unegister EventLog -->
153- <Binary Id="UNREGISTEREventlog" SourceFile="C:\Windows\System32\reg.exe"> </Binary>
197+ <!--Binary Id="UNREGISTEREventlog" SourceFile="C:\Windows\System32\reg.exe"> </Binary-->
154198 <!--CustomAction Id="UnregisterEventlog" BinaryKey="UNREGISTEREventlog" Execute="deferred" Return="asyncWait" Impersonate="no"
155199 ExeCommand=" DELETE HKLM\System\CurrentControlSet\Services\Eventlog\Application\&quot;$(var.ProductName)&quot; /f /va" /-->
156- <CustomAction Id="UnregisterEventlog" BinaryKey="UNREGISTEREventlog" Execute="deferred" Return="asyncWait" Impersonate="no"
157- ExeCommand=" DELETE HKLM\System\CurrentControlSet\Services\Eventlog\Application\FlushMouse /f" />
200+ <!--CustomAction Id="UnregisterEventlog" BinaryKey="UNREGISTEREventlog" Execute="deferred" Return="asyncWait" Impersonate="no"
201+ ExeCommand=" DELETE HKLM\System\CurrentControlSet\Services\Eventlog\Application\FlushMouse /f" /-->
158202 <!-- Remove Registry in Uninstall -->
159203 <Binary Id="REMOVEREG" SourceFile="C:\Windows\System32\reg.exe"> </Binary>
160204 <CustomAction Id="RemoveReg" BinaryKey="REMOVEREG" Execute="immediate" Return="asyncNoWait" Impersonate="yes"
@@ -194,6 +238,7 @@
194238 <Feature Id="EssentialFeature" Level="1">
195239 <ComponentGroupRef Id="ProductComponents" />
196240 <!--ComponentRef Id="AutoStartRegistry" /-->
241+ <ComponentRef Id="EventLogRegistry" />
197242 <ComponentRef Id="Registries" />
198243 <ComponentRef Id="Shortcuts" />
199244 <ComponentRef Id="DesktopShortcut" />
@@ -222,6 +267,9 @@
222267 <Component Id="Register_TaskScheduler.xml" Guid="{3FA0C6AB-6E9C-4B55-BE44-A02A3B6A0C3E}">
223268 <File Id="Register_TaskScheduler.xml" Name="Register_TaskScheduler.xml" Source="$(var.TargetDir04)Register_TaskScheduler.xml" />
224269 </Component>
270+ <Component Id="Register_TaskScheduler2.xml" Guid="{17BD4844-87C4-4A06-BBF3-86C94D22C5DC}">
271+ <File Id="Register_TaskScheduler2.xml" Name="Register_TaskScheduler2.xml" Source="$(var.TargetDir04)Register_TaskScheduler2.xml" />
272+ </Component>
225273 <Component Id="License.rtf" Guid="{E6E55A92-6BE8-4612-8172-0BC04811D6E1}">
226274 <File Id="License.rtf" Name="License.rtf" Source="$(var.TargetDir04)License.rtf" />
227275 </Component>
@@ -240,10 +288,18 @@
240288 <!-- Registries -->
241289 <!-- Auto start by user registry -->
242290 <!--Component Id="AutoStartRegistry" Guid="{AE2203C7-DFFF-40AA-873F-39C206583E9C}"-->
243- <!--RegistryKey Root="HKCU" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="no"-->
244- <!--RegistryValue Type="string" Name="$(var.ProductName)" Value="[INSTALLFOLDER]$(var.MainExeFileName)" KeyPath="yes" /-->
245- <!--/RegistryKey-->
291+ <!--RegistryKey Root="HKCU" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="no"-->
292+ <!--RegistryValue Type="string" Name="$(var.ProductName)" Value="[INSTALLFOLDER]$(var.MainExeFileName)" KeyPath="yes" /-->
293+ <!--/RegistryKey-->
246294 <!--/Component-->
295+ <!-- EventLog registry -->
296+ <Component Id="EventLogRegistry" Guid="{B5A28410-C07F-43BD-BA17-D15F0331986B}">
297+ <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\EventLog\Application\$(var.ProductName)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
298+ <RegistryValue Type="integer" Name="CustomSource" Value="00000001"/>
299+ <RegistryValue Type="integer" Name="TypesSupported" Value="00000007"/>
300+ <RegistryValue Type="expandable" Name="EventMessageFile" Value="%ProgramFiles%\$(var.Manufacturer)\$(var.ProductName)\FlushMouseDLL.dll"/>
301+ </RegistryKey>
302+ </Component>
247303 <!-- App registries -->
248304 <Component Id="Registries" Guid="{05B14589-18DE-4AE3-B6D8-EB65FA40B46D}">
249305 <RegistryKey Root="HKLM" Key="$(var.AppRegKey)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="no">
--- a/SetupProject/Readme.txt
+++ b/SetupProject/Readme.txt
@@ -9,6 +9,7 @@
99 FlushMouseDLL32.dll
1010 Register_Eventlog.reg
1111 Register_TaskScheduler.xml
12+ Register_TaskScheduler2.xml
1213 License.rtf
1314 Readme.txt
1415
Binary files a/SetupProject/Register_TaskScheduler.xml and b/SetupProject/Register_TaskScheduler.xml differ
Binary files /dev/null and b/SetupProject/Register_TaskScheduler2.xml differ
--- a/SetupProject/SetupProject.wixproj
+++ b/SetupProject/SetupProject.wixproj
@@ -20,6 +20,8 @@
2020 <OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
2121 <IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
2222 <CompilerAdditionalOptions>-arch x64</CompilerAdditionalOptions>
23+ <SuppressValidation>False</SuppressValidation>
24+ <SuppressIces>ICE61</SuppressIces>
2325 </PropertyGroup>
2426 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
2527 <DefineConstants>Debug</DefineConstants>
@@ -45,6 +47,7 @@
4547 <Content Include="Readme.txt" />
4648 <Content Include="Register_Eventlog.reg" />
4749 <Content Include="Register_TaskScheduler.xml" />
50+ <Content Include="Register_TaskScheduler2.xml" />
4851 </ItemGroup>
4952 <ItemGroup>
5053 <ProjectReference Include="..\FlushMouse32\FlushMouse32.vcxproj">
@@ -90,6 +93,9 @@
9093 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
9194 <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
9295 </Target>
96+ <PropertyGroup>
97+ <PostBuildEvent>copy "$(TargetDir)ja-JP\$(TargetFileName)" "$(SolutionDir)$(TargetFileName)"</PostBuildEvent>
98+ </PropertyGroup>
9399 <!--
94100 To modify your build process, add your task inside one of the targets below and uncomment it.
95101 Other similar extension points exist, see Wix.targets.
--- a/SetupProject/_ExitDialog.wxs
+++ b/SetupProject/_ExitDialog.wxs
@@ -5,27 +5,27 @@
55 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
66 <Fragment>
77 <UI>
8- <Dialog Id="_ExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
9- <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
10- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" />
11- <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" />
12- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
13- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
14- <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />
15- <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
16- <Control Id="OptionalText" Type="Text" X="135" Y="110" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="[WIXUI_EXITDIALOGOPTIONALTEXT]">
8+ <Dialog Id="_ExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
9+ <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
10+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" />
11+ <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" />
12+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
13+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
14+ <Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />
15+ <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
16+ <!--Control Id="OptionalText" Type="Text" X="135" Y="110" Width="220" Height="80" Transparent="yes" NoPrefix="yes" Hidden="yes" Text="[WIXUI_EXITDIALOGOPTIONALTEXT]">
1717 <Condition Action="show">WIXUI_EXITDIALOGOPTIONALTEXT AND NOT Installed</Condition>
18- </Control>
18+ </Control-->
1919 <!--Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]"-->
2020 <!--Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="100" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
2121 <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
2222 </Control-->
23- <Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="100" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
23+ <!--Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="100" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
2424 <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
25- </Control>
25+ </Control-->
2626 </Dialog>
2727
28- <InstallUISequence>
28+ <InstallUISequence>
2929 <Show Dialog="_ExitDialog" OnExit="success" Overridable="yes" />
3030 </InstallUISequence>
3131
--- a/SetupProject/_VerifyReadyDlg.wxs
+++ b/SetupProject/_VerifyReadyDlg.wxs
@@ -7,19 +7,22 @@
77 <UI>
88 <Dialog Id="_VerifyReadyDlg" Width="370" Height="270" Title="!(loc.VerifyReadyDlg_Title)" TrackDiskSpace="yes">
99 <!--@@@ start-->
10- <!-- Install -->
11- <Control Id="OptionalCheckBox1" Type="CheckBox" X="80" Y="150" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX1" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT1]">
12- <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3 AND NOT Installed</Condition>
10+ <!-- Install -->
11+ <Control Id="OptionalCheckBox1" Type="CheckBox" X="80" Y="145" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX1" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT1]">
12+ <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT1 AND NOT Installed</Condition>
13+ </Control>
14+ <Control Id="OptionalCheckBox2" Type="CheckBox" X="80" Y="160" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX2" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT2]">
15+ <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT2 AND NOT Installed</Condition>
1316 </Control>
14- <Control Id="OptionalCheckBox2" Type="CheckBox" X="80" Y="170" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX2" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT2]">
17+ <Control Id="OptionalCheckBox3" Type="CheckBox" X="80" Y="175" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3]">
1518 <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3 AND NOT Installed</Condition>
1619 </Control>
1720 <Control Id="Comment1" Type="Text" X="80" Y="190" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCOMMENT1" Text="[WIXUI_VERIFYDIALOGOPTIONALCOMMENT1]">
18- <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3 AND NOT Installed</Condition>
21+ <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCOMMENT1 AND NOT Installed</Condition>
1922 </Control>
2023 <!-- Uninstall -->
21- <Control Id="OptionalCheckBox3" Type="CheckBox" X="80" Y="170" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX3" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3]">
22- <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT3 AND Installed</Condition>
24+ <Control Id="OptionalCheckBox4" Type="CheckBox" X="80" Y="175" Width="220" Height="20" Hidden="yes" Property="WIXUI_VERIFYDIALOGOPTIONALCHECKBOX4" CheckBoxValue="1" Text="[WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT4]">
25+ <Condition Action="show">WIXUI_VERIFYDIALOGOPTIONALCHECKBOXTEXT4 AND Installed</Condition>
2326 </Control>
2427 <!--@@@ end-->
2528 <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Hidden="yes" Disabled="yes" Text="!(loc.VerifyReadyDlgInstall)">
--- a/version.h
+++ b/version.h
@@ -6,13 +6,13 @@
66 // #0000 2023/03/17 JeffyTS New edit.
77 //
88
9-#define MAJOR_VERSION 0
10-#define MINOR_VERSION 9
11-#define BUILD_VERSION 4
12-#define REVISON_VERSION 14
9+#define MAJOR_VERSION 1
10+#define MINOR_VERSION 0
11+#define BUILD_VERSION 0
12+#define REVISON_VERSION 1
1313
14-#define FILE_VERSION_STRING VALUE "FileVersion", "0.9.4.14"
15-#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "0.9.4.14"
14+#define FILE_VERSION_STRING VALUE "FileVersion", "1.0.0.1"
15+#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "1.0.0.1"
1616
1717 #define FILE_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION
1818 #define PRODUCT_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISON_VERSION
--- a/version.wxi
+++ b/version.wxi
@@ -1,5 +1,5 @@
11 <Include>
22 <!-- for wix Setup Project -->
3- <?define Version = "0.9.4.14" ?>
3+ <?define Version = "1.0.0.1" ?>
44 </Include>
55