• 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évision302021f8d609c0e82e511ba72cb05e635fd4e901 (tree)
l'heure2023-08-24 14:20:26
AuteurJeffyTS <jeffyts@outl...>
CommiterJeffyTS

Message de Log

1.1.7.24

Change Summary

Modification

--- a/FlushMouse/FlushMouse.cpp
+++ b/FlushMouse/FlushMouse.cpp
@@ -1,6 +1,6 @@
11 //
22 // FlushMouse.cpp
3-// for Windows10/11 Win32 API msi Packaage App.
3+// for Windows10/11 Win32 API msi Package App.
44 // Copyright (C) 1993 JeffyTS
55 //
66 // FlushMouse.exe
@@ -8,8 +8,8 @@
88 //
99 // No. Date Name Reason & Document
1010 // -------+-----------+-----------+-------------------------------------------- -
11-// #0000 1993/11/17 JeffyTS New edit.
12-// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
11+// #0000 1993/11/17 JeffyTS New edit.
12+// #0001 2022/02/04 JeffyTS Visual Studio 2022 (C++)へ移植
1313 //
1414
1515 //
@@ -115,7 +115,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
115115 if (Resource->hLoad() == NULL) {
116116 return (-1);
117117 }
118- if (!bWinMain(hInstance, hPrevInstance)) return (-1);
118+
119+ if (!bWinMain(hInstance, hPrevInstance, nCmdShow)) return (-1);
119120
120121 MSG msg{};
121122 while (GetMessage(&msg, NULL, 0, 0)) {
@@ -153,7 +154,7 @@ BOOL bSetHeapInformation()
153154 //
154155 void vMessageBox(HWND hWnd, UINT uID, UINT uType)
155156 {
156- TCHAR lpText[MAX_LOADSTRING];
157+ TCHAR lpText[MAX_LOADSTRING];
157158 try {
158159 throw LoadString(Resource->hLoad(), uID, lpText, MAX_LOADSTRING);
159160 }
--- a/FlushMouse/FlushMouse.exe.manifest
+++ b/FlushMouse/FlushMouse.exe.manifest
@@ -1,15 +1,15 @@
11 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22 <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 -->
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 -->
1313 <maxversiontested Id="10.0.19041.0"/>
1414 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
1515 <!-- DPI Awareness -->
@@ -17,25 +17,18 @@
1717 <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
1818 PerMonitorV2, PerMonitor
1919 </dpiAwareness>
20- <!-- GDI Scaling -->
20+ <!-- GDI Scaling -->
2121 <gdiScaling>true</gdiScaling>
2222 </application>
23- </compatibility>
23+ </compatibility>
2424 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
25- <security>
25+ <security>
2626 <requestedPrivileges>
2727 <!-- UAC settings -->
2828 <!--requestedExecutionLevel level="requireAdministrator" uiAccess="false"/-->
29- <!--requestedExecutionLevel level="highestAvailable" uiAccess="false"/-->
29+ <!--requestedExecutionLevel level="highestAvailable" uiAccess="true"/-->
3030 <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
3131 </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-
32+ </security>
33+ </trustInfo>
4134 </assembly>
\ No newline at end of file
--- a/FlushMouse/FlushMouse.h
+++ b/FlushMouse/FlushMouse.h
@@ -24,8 +24,8 @@
2424 //
2525 // Global Data
2626 //
27-extern TCHAR szFlushMouseDLL[];
28-extern TCHAR szFlushMouse32[];
27+extern TCHAR szFlushMouseDLL[];
28+extern TCHAR szFlushMouse32[];
2929
3030
3131 /* = EOF = */
\ No newline at end of file
--- a/FlushMouse/FlushMouse.vcxproj
+++ b/FlushMouse/FlushMouse.vcxproj
@@ -234,9 +234,6 @@
234234 </ProjectReference>
235235 </ItemGroup>
236236 <ItemGroup>
237- <Manifest Include="FlushMouse.exe.manifest" />
238- </ItemGroup>
239- <ItemGroup>
240237 <ResourceCompile Include="..\FlushMouseLIB\FlushMouse.rc" />
241238 </ItemGroup>
242239 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
--- a/FlushMouse/FlushMouse.vcxproj.filters
+++ b/FlushMouse/FlushMouse.vcxproj.filters
@@ -45,9 +45,6 @@
4545 </Image>
4646 </ItemGroup>
4747 <ItemGroup>
48- <Manifest Include="FlushMouse.exe.manifest" />
49- </ItemGroup>
50- <ItemGroup>
5148 <ResourceCompile Include="..\FlushMouseLIB\FlushMouse.rc">
5249 <Filter>リソース ファイル</Filter>
5350 </ResourceCompile>
--- a/FlushMouse32/FlushMouse32.cpp
+++ b/FlushMouse32/FlushMouse32.cpp
@@ -14,8 +14,8 @@
1414 #include "pch.h"
1515 #include "FlushMouse32.h"
1616 #include "Resource.h"
17+#include "..\FlushMouseDLL32\MouseHookDLL32.h"
1718 #include "..\FlushMouseLIB\CommonDef.h"
18-#include "..\FlushMouseDLL32\MouseHookDll32.h"
1919 #include "..\FlushMouseDLL\EventlogData.h"
2020
2121 #ifdef _DEBUG
@@ -111,7 +111,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
111111 }
112112 }
113113
114- HWND hWnd = NULL;
114+ HWND hWnd = NULL;
115115 if ((hWnd = FindWindow(CLASS_FLUSHMOUSE32, NULL)) != NULL) {
116116 SetFocus(GetLastActivePopup(hWnd));
117117 PostMessage(hWnd, WM_DESTROY, NULL, NULL);
@@ -149,22 +149,22 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
149149 //
150150 static ATOM MyRegisterClass(HINSTANCE hInstance)
151151 {
152-#define CLASSSTYLE CS_HREDRAW | CS_VREDRAW // クラススタイル
152+#define CLASSSTYLE CS_HREDRAW | CS_VREDRAW
153153
154154 WNDCLASSEX wcex{};
155155
156156 wcex.cbSize = sizeof(WNDCLASSEX);
157- wcex.style = CLASSSTYLE; // クラススタイル
157+ wcex.style = CLASSSTYLE;
158158 wcex.lpfnWndProc = WndProc;
159- wcex.cbClsExtra = 0; // クラスの補足データなし
160- wcex.cbWndExtra = 0; // ウィンドウの補足データなし
161- wcex.hInstance = hInstance; // クラスのウィンドウハンドル
162- wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FLUSHMOUSE32)); // アイコンハンドル
163- wcex.hCursor = LoadCursor(NULL, IDC_ARROW); // マウスカーソルハンドル
164- wcex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // ウィンドウ背景色
165- wcex.lpszMenuName = MAKEINTRESOURCE(IDC_FLUSHMOUSE32); // デフォルトメニュー名
166- wcex.lpszClassName = CLASS_FLUSHMOUSE32; // このウインドウクラスにつける名前
167- wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); // 16×16の小さいサイズのアイコン
159+ wcex.cbClsExtra = 0;
160+ wcex.cbWndExtra = 0;
161+ wcex.hInstance = hInstance;
162+ wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FLUSHMOUSE32));
163+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
164+ wcex.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
165+ wcex.lpszMenuName = MAKEINTRESOURCE(IDC_FLUSHMOUSE32);
166+ wcex.lpszClassName = CLASS_FLUSHMOUSE32;
167+ wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
168168
169169 return RegisterClassEx(&wcex);
170170 }
@@ -175,22 +175,22 @@ static ATOM MyRegisterClass(HINSTANCE hInstance)
175175 static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
176176 {
177177 UNREFERENCED_PARAMETER(nCmdShow);
178-#define WINDOWSTYLE WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL // | WS_VISIBLE // WS_MINIMIZE | WS_SYSMENU
179- hInst = hInstance; // グローバル変数にインスタンス ハンドルを格納する
180- HWND hWnd = NULL; // メインウィンドウのハンドル
178+#define WINDOWSTYLE WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL
179+ hInst = hInstance;
180+ HWND hWnd = NULL;
181181 hWnd = CreateWindowEx(
182- WS_DISABLED, // Disabled Window
183- CLASS_FLUSHMOUSE32, // RegisterClass()呼び出しを参照
184- szTitle, // Title barのテキスト
185- WINDOWSTYLE, // Window style
186- 0, 0, // 水平・垂直位置
187- 0, 0, // 幅・高さ
188- NULL, // 親オーバーラップウィンドウ
189- NULL, // ウィンドウクラスのメニューを使う
190- hInstance, // 所有インスタンス
191- NULL); // ポインタは不要
182+ WS_DISABLED,
183+ CLASS_FLUSHMOUSE32,
184+ szTitle,
185+ WINDOWSTYLE,
186+ 0, 0,
187+ 0, 0,
188+ NULL,
189+ NULL,
190+ hInstance,
191+ NULL);
192192 if (!hWnd) {
193- return FALSE; // ウィンドウを作成できなかったときはFALSEを返す
193+ return FALSE;
194194 }
195195 return TRUE;
196196 }
@@ -223,9 +223,9 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
223223 PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
224224 return FALSE;
225225 }
226- BOOL bBool = FALSE;
226+
227+ BOOL bBool = FALSE;
227228 if (SetUserObjectInformation(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION, &bBool, sizeof(BOOL)) != FALSE) {
228- // Set Timer for Proc
229229 if (uCheckProcTimer == NULL) {
230230 if ((uCheckProcTimer = SetTimer(hWnd, nCheckProcTimerID, nCheckProcTimerTickValue, (TIMERPROC)&vCheckProcTimerProc)) == 0) {
231231 vMessageBox(hWnd, IDS_NOTREGISTEHOOK, MessageBoxTYPE);
@@ -249,13 +249,14 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
249249 //
250250 static void Cls_OnDestroy(HWND hWnd)
251251 {
252- bMouseHookUnset32();
253-
254252 if (uCheckProcTimer != NULL) {
255253 if (KillTimer(hWnd, nCheckProcTimerID)) {
256254 uCheckProcTimer = NULL;
257255 }
258256 }
257+
258+ bMouseHookUnset32();
259+
259260 PostQuitMessage(0);
260261 }
261262
@@ -299,7 +300,7 @@ static VOID CALLBACK vCheckProcTimerProc(HWND hWnd, UINT uMsg, UINT uTimerID, DW
299300 //
300301 static BOOL bReportEvent(DWORD dwEventID, WORD wCategory)
301302 {
302- BOOL bRet = FALSE;
303+ BOOL bRet = FALSE;
303304 HANDLE hEvent = RegisterEventSource(NULL, _T("FlushMouse"));
304305 if (hEvent != NULL) {
305306 if (ReportEvent(hEvent, (0x0000000c & (dwEventID >> 28)), wCategory, dwEventID, NULL, 0, 0, NULL, NULL) != 0) {
@@ -333,7 +334,7 @@ static BOOL bCreateProcess(LPCTSTR lpszExecName)
333334 CloseHandle(ProcessInfomation.hThread);
334335 bRet = TRUE;
335336 }
336- delete[] lpszBuffer;
337+ delete[] lpszBuffer;
337338 }
338339 return bRet;
339340 }
--- a/FlushMouse32/FlushMouse32.exe.manifest
+++ b/FlushMouse32/FlushMouse32.exe.manifest
@@ -1,15 +1,15 @@
11 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22 <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 -->
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 -->
1313 <maxversiontested Id="10.0.19041.0"/>
1414 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
1515 <!-- DPI Awareness -->
@@ -17,18 +17,18 @@
1717 <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
1818 PerMonitorV2, PerMonitor
1919 </dpiAwareness>
20- <!-- GDI Scaling -->
20+ <!-- GDI Scaling -->
2121 <gdiScaling>true</gdiScaling>
2222 </application>
23- </compatibility>
23+ </compatibility>
2424 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
25- <security>
25+ <security>
2626 <requestedPrivileges>
2727 <!-- UAC settings -->
2828 <!--requestedExecutionLevel level="requireAdministrator" uiAccess="false"/-->
29- <!--requestedExecutionLevel level="highestAvailable" uiAccess="false"/-->
29+ <!--requestedExecutionLevel level="highestAvailable" uiAccess="true"/-->
3030 <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
3131 </requestedPrivileges>
32- </security>
33- </trustInfo>
32+ </security>
33+ </trustInfo>
3434 </assembly>
--- a/FlushMouse32/FlushMouse32.h
+++ b/FlushMouse32/FlushMouse32.h
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/04/06 JeffyTS New edit.
7+// #0000 2022/04/06 JeffyTS New edit.
88 //
99
1010 //
--- a/FlushMouse32/FlushMouse32.vcxproj
+++ b/FlushMouse32/FlushMouse32.vcxproj
@@ -115,6 +115,7 @@
115115 <GenerateDebugInformation>true</GenerateDebugInformation>
116116 <AdditionalDependencies>..\$(Platform)\$(Configuration)\FlushMouseDLL32.lib;..\$(Platform)\$(Configuration)\MiscLIB32.lib;%(AdditionalDependencies)</AdditionalDependencies>
117117 <EnableUAC>false</EnableUAC>
118+ <UACUIAccess>false</UACUIAccess>
118119 </Link>
119120 <PostBuildEvent>
120121 <Command>copy ..\$(Platform)\$(Configuration)\FlushMouse32.exe ..\x64\$(Configuration)\</Command>
@@ -143,6 +144,7 @@
143144 <GenerateDebugInformation>false</GenerateDebugInformation>
144145 <AdditionalDependencies>..\$(Platform)\$(Configuration)\FlushMouseDLL32.lib;..\$(Platform)\$(Configuration)\MiscLIB32.lib;%(AdditionalDependencies)</AdditionalDependencies>
145146 <EnableUAC>false</EnableUAC>
147+ <UACUIAccess>false</UACUIAccess>
146148 </Link>
147149 <PostBuildEvent>
148150 <Command>copy ..\$(Platform)\$(Configuration)\FlushMouse32.exe ..\x64\$(Configuration)\</Command>
@@ -165,6 +167,7 @@
165167 <GenerateDebugInformation>true</GenerateDebugInformation>
166168 <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
167169 <EnableUAC>false</EnableUAC>
170+ <UACUIAccess>false</UACUIAccess>
168171 </Link>
169172 <Manifest>
170173 <InputResourceManifests>FlushMouse32.exe.manifest</InputResourceManifests>
@@ -188,6 +191,7 @@
188191 <GenerateDebugInformation>false</GenerateDebugInformation>
189192 <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
190193 <EnableUAC>false</EnableUAC>
194+ <UACUIAccess>false</UACUIAccess>
191195 </Link>
192196 <Manifest>
193197 <InputResourceManifests>FlushMouse32.exe.manifest</InputResourceManifests>
@@ -223,9 +227,6 @@
223227 <Project>{3d3f632c-75bb-4830-aa8e-0871c6aa1a72}</Project>
224228 </ProjectReference>
225229 </ItemGroup>
226- <ItemGroup>
227- <Manifest Include="FlushMouse32.exe.manifest" />
228- </ItemGroup>
229230 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
230231 <ImportGroup Label="ExtensionTargets">
231232 </ImportGroup>
--- a/FlushMouse32/FlushMouse32.vcxproj.filters
+++ b/FlushMouse32/FlushMouse32.vcxproj.filters
@@ -55,7 +55,4 @@
5555 <Filter>リソース ファイル</Filter>
5656 </Image>
5757 </ItemGroup>
58- <ItemGroup>
59- <Manifest Include="FlushMouse32.exe.manifest" />
60- </ItemGroup>
6158 </Project>
\ No newline at end of file
--- a/FlushMouseCursor/FlushMouseCursor.cpp
+++ b/FlushMouseCursor/FlushMouseCursor.cpp
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/03/17 JeffyTS New edit.
7+// #0000 2022/03/17 JeffyTS New edit.
88 //
99
1010 //
--- a/FlushMouseCursor/FlushMouseCursor.h
+++ b/FlushMouseCursor/FlushMouseCursor.h
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/03/17 JeffyTS New edit.
7+// #0000 2022/03/17 JeffyTS New edit.
88 //
99
1010 //
--- a/FlushMouseCursor/FlushMouseCursor.vcxproj
+++ b/FlushMouseCursor/FlushMouseCursor.vcxproj
@@ -117,6 +117,7 @@
117117 <SubSystem>Windows</SubSystem>
118118 <GenerateDebugInformation>true</GenerateDebugInformation>
119119 <EnableUAC>false</EnableUAC>
120+ <UACUIAccess>false</UACUIAccess>
120121 </Link>
121122 <PostBuildEvent>
122123 <Command>
@@ -142,6 +143,7 @@
142143 <OptimizeReferences>true</OptimizeReferences>
143144 <GenerateDebugInformation>false</GenerateDebugInformation>
144145 <EnableUAC>false</EnableUAC>
146+ <UACUIAccess>false</UACUIAccess>
145147 </Link>
146148 <PostBuildEvent>
147149 <Command>
@@ -162,6 +164,7 @@
162164 <SubSystem>Windows</SubSystem>
163165 <GenerateDebugInformation>true</GenerateDebugInformation>
164166 <EnableUAC>false</EnableUAC>
167+ <UACUIAccess>false</UACUIAccess>
165168 </Link>
166169 <PostBuildEvent>
167170 <Command>copy $(OutDir)FlushMouseCursor.dll $(OutDir)FlushMouseCursor.dat
@@ -188,6 +191,7 @@
188191 <OptimizeReferences>true</OptimizeReferences>
189192 <GenerateDebugInformation>true</GenerateDebugInformation>
190193 <EnableUAC>false</EnableUAC>
194+ <UACUIAccess>false</UACUIAccess>
191195 </Link>
192196 <PostBuildEvent>
193197 <Command>copy $(OutDir)FlushMouseCursor.dll $(OutDir)FlushMouseCursor.dat
--- a/FlushMouseDLL/EventlogDll.cpp
+++ b/FlushMouseDLL/EventlogDll.cpp
@@ -18,7 +18,7 @@
1818 //
1919 DLLEXPORT BOOL __stdcall bReportEvent(DWORD dwEventID, WORD wCategory)
2020 {
21- BOOL bRet = FALSE;
21+ BOOL bRet = FALSE;
2222 HANDLE hEvent = RegisterEventSource(NULL, _T("FlushMouse"));
2323 if (hEvent != NULL) {
2424 if (ReportEvent(hEvent, (0x0000000c & (dwEventID >> 28)), wCategory, dwEventID, NULL, 0, 0, NULL, NULL) != 0) {
--- a/FlushMouseDLL/FlushMouseDLL.vcxproj
+++ b/FlushMouseDLL/FlushMouseDLL.vcxproj
@@ -108,6 +108,7 @@
108108 <SubSystem>Windows</SubSystem>
109109 <GenerateDebugInformation>true</GenerateDebugInformation>
110110 <EnableUAC>false</EnableUAC>
111+ <UACUIAccess>false</UACUIAccess>
111112 </Link>
112113 </ItemDefinitionGroup>
113114 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -129,6 +130,7 @@
129130 <OptimizeReferences>true</OptimizeReferences>
130131 <GenerateDebugInformation>false</GenerateDebugInformation>
131132 <EnableUAC>false</EnableUAC>
133+ <UACUIAccess>false</UACUIAccess>
132134 </Link>
133135 </ItemDefinitionGroup>
134136 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -147,6 +149,7 @@
147149 <GenerateDebugInformation>true</GenerateDebugInformation>
148150 <EnableUAC>false</EnableUAC>
149151 <AdditionalDependencies>..\$(Platform)\$(Configuration)\MiscLIB.lib;%(AdditionalDependencies)</AdditionalDependencies>
152+ <UACUIAccess>false</UACUIAccess>
150153 </Link>
151154 <PreBuildEvent>
152155 <Command>
@@ -179,6 +182,7 @@
179182 <GenerateDebugInformation>true</GenerateDebugInformation>
180183 <EnableUAC>false</EnableUAC>
181184 <AdditionalDependencies>..\$(Platform)\$(Configuration)\MiscLIB.lib;%(AdditionalDependencies)</AdditionalDependencies>
185+ <UACUIAccess>false</UACUIAccess>
182186 </Link>
183187 <PreBuildEvent>
184188 <Command>
@@ -197,6 +201,7 @@
197201 <ClInclude Include="framework.h" />
198202 <ClInclude Include="GlobalHookDll.h" />
199203 <ClInclude Include="KeyboardHookDll.h" />
204+ <ClInclude Include="MouseHookDll.h" />
200205 <ClInclude Include="pch.h" />
201206 <ClInclude Include="Resource.h" />
202207 <ClInclude Include="ShellHookDll.h" />
@@ -207,6 +212,7 @@
207212 <ClCompile Include="FlushMouseDll.cpp" />
208213 <ClCompile Include="GlobalHookDll.cpp" />
209214 <ClCompile Include="KeyboardHookDll.cpp" />
215+ <ClCompile Include="MouseHookDll.cpp" />
210216 <ClCompile Include="pch.cpp">
211217 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
212218 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
--- a/FlushMouseDLL/FlushMouseDLL.vcxproj.filters
+++ b/FlushMouseDLL/FlushMouseDLL.vcxproj.filters
@@ -48,6 +48,9 @@
4848 <ClInclude Include="ShellHookDll.h">
4949 <Filter>ヘッダー ファイル</Filter>
5050 </ClInclude>
51+ <ClInclude Include="MouseHookDll.h">
52+ <Filter>ヘッダー ファイル</Filter>
53+ </ClInclude>
5154 </ItemGroup>
5255 <ItemGroup>
5356 <ClCompile Include="FlushMouseDll.cpp">
@@ -68,6 +71,9 @@
6871 <ClCompile Include="ShellHookDll.cpp">
6972 <Filter>ソース ファイル</Filter>
7073 </ClCompile>
74+ <ClCompile Include="MouseHookDll.cpp">
75+ <Filter>ソース ファイル</Filter>
76+ </ClCompile>
7177 </ItemGroup>
7278 <ItemGroup>
7379 <ResourceCompile Include="FlushMouseDLL.rc">
--- a/FlushMouseDLL/FlushMouseDll.h
+++ b/FlushMouseDLL/FlushMouseDll.h
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/02/12 JeffyTS New edit.
7+// #0000 2022/02/12 JeffyTS New edit.
88 //
99
1010 //
--- a/FlushMouseDLL/GlobalHookDll.cpp
+++ b/FlushMouseDLL/GlobalHookDll.cpp
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/03/04 JeffyTS New edit.
7+// #0000 2022/03/04 JeffyTS New edit.
88 //
99
1010 //
@@ -23,8 +23,6 @@
2323 // Local Prototype Define
2424 //
2525 static LRESULT CALLBACK lpGlobalHookProc(int, WPARAM, LPARAM);
26-static BOOL bGlobalHookProcSub()
27-;
2826
2927 //
3028 // Local Data
@@ -106,6 +104,9 @@ DLLEXPORT BOOL __stdcall bGlobalHookUnset()
106104 //
107105 //フックの処理
108106 //
107+template<typename T1, typename T2>
108+constexpr DWORD WORD2DWORD(T1 h, T2 l) { return (DWORD)(((((DWORD)(l)) << 16) & 0xffff0000) | ((DWORD)(h) & 0xffff)); }
109+
109110 static LRESULT CALLBACK lpGlobalHookProc(int nCode, WPARAM wParam, LPARAM lParam)
110111 {
111112 if (nCode < 0) {
@@ -116,37 +117,31 @@ static LRESULT CALLBACK lpGlobalHookProc(int nCode, WPARAM wParam, LPARAM lParam
116117 switch (lpCW->message) {
117118 case WM_IME_STARTCOMPOSITION: // 0x010D
118119 if (lpCW->lResult != 0) {
119- if (bGlobalHookProcSub()) {
120- PostMessage(hWndGLParent, WM_CHECKIMESTARTCONVEX, (WPARAM)TRUE, (LPARAM)0);
121- }
120+ PostMessage(hWndGLParent, WM_CHECKIMESTARTCONVEX, (WPARAM)TRUE, (LPARAM)0);
122121 }
123122 return CallNextHookEx(NULL, nCode, wParam, lParam);
124123 case WM_IME_ENDCOMPOSITION: // 0x010E
125124 if (lpCW->lResult != 0) {
126- if (bGlobalHookProcSub()) {
127- PostMessage(hWndGLParent, WM_CHECKIMESTARTCONVEX, (WPARAM)FALSE, (LPARAM)0);
128- }
125+ PostMessage(hWndGLParent, WM_CHECKIMESTARTCONVEX, (WPARAM)FALSE, (LPARAM)0);
129126 }
130127 return CallNextHookEx(NULL, nCode, wParam, lParam);
131128 default:
132129 if (lpCW->message == WM_HOOKEX) {
133- if (bGlobalHookProcSub()) {
134- if (lpCW->lParam) {
135- if (!bSubclassed) {
136- if (hHookGL == NULL) break;
137- if (UnhookWindowsHookEx(hHookGL) != FALSE) {
138- if (LoadLibraryEx(FLUSHMOUSE_DLL, NULL, 0)) {
139- bSubclassed = TRUE;
140- }
141- hHookGL = NULL;
130+ if (lpCW->lParam) {
131+ if (!bSubclassed) {
132+ if (hHookGL == NULL) break;
133+ if (UnhookWindowsHookEx(hHookGL) != FALSE) {
134+ if (LoadLibraryEx(FLUSHMOUSE_DLL, NULL, 0)) {
135+ bSubclassed = TRUE;
142136 }
137+ hHookGL = NULL;
143138 }
144139 }
145- else {
146- if (bSubclassed) {
147- if (hHookGL == NULL) break;
148- bSubclassed = FALSE;
149- }
140+ }
141+ else {
142+ if (bSubclassed) {
143+ if (hHookGL == NULL) break;
144+ bSubclassed = FALSE;
150145 }
151146 }
152147 }
@@ -156,19 +151,5 @@ static LRESULT CALLBACK lpGlobalHookProc(int nCode, WPARAM wParam, LPARAM lParam
156151 return CallNextHookEx(NULL, nCode, wParam, lParam);
157152 }
158153
159-//
160-// bGlobalHookProcSub
161-//
162-static BOOL bGlobalHookProcSub()
163-{
164- if (lpDatGlobal == NULL) {
165- if ((lpDatGlobal = (LPGLOBAL_SHAREDMEM)CSharedMem->lpvSharedMemoryRead()) == NULL) {
166- return FALSE;
167- }
168- }
169- hWndGLParent = lpDatGlobal->hWnd;
170- hHookGL = lpDatGlobal->hHook;
171- return TRUE;
172-}
173154
174155 /* = EOF = */
\ No newline at end of file
--- a/FlushMouseDLL/KeyboardHookDll.cpp
+++ b/FlushMouseDLL/KeyboardHookDll.cpp
@@ -4,7 +4,7 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/02/12 JeffyTS New edit.
7+// #0000 2022/02/12 JeffyTS New edit.
88 //
99
1010 //
@@ -27,19 +27,18 @@
2727 #pragma comment(linker, "/SECTION:FLUSHMOUSEDLL_SEG,RWS")
2828 #pragma data_seg("FLUSHMOUSEDLL_SEG")
2929 static BOOL bOnlyCtrlLL = FALSE;
30-static DWORD dwPreviousVKLL = 0;
30+static DWORD dwPreviousVKLL = 0;
3131 static HWND hWndKBParentLL = NULL;
3232 static LPKEYBOARDLL_SHAREDMEM lpDatKeyboardLL = NULL;
3333 static BOOL bEnableEPHelperLL = FALSE;
3434 static BOOL bStartConvertingLL = FALSE;
35-static CSharedMemory *CSharedMemLL = NULL;
35+static CSharedMemory *CSharedMemLL = NULL;
3636 #pragma data_seg()
3737
3838 //
3939 // Local Prototype Define
4040 //
4141 static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lParam);
42-static BOOL bKeyboardHookLLProcSub();
4342 static BOOL bKBisEP();
4443
4544 //
@@ -128,28 +127,24 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
128127 if (nCode == HC_ACTION) {
129128 LPKBDLLHOOKSTRUCT lpstKBH = (LPKBDLLHOOKSTRUCT)lParam;
130129 if ((lpstKBH->flags & LLKHF_UP)) { // Key up
131- dwPreviousVKLL = 0; // Reset vkCode
130+ dwPreviousVKLL = 0;
132131 switch (lpstKBH->vkCode) {
133132 case VK_CONTROL: // Ctrl (0x11)
134133 case VK_LCONTROL: // Ctrl L (0xa2)
135134 case VK_RCONTROL: // Ctrl R (0xa3)
136135 if (bOnlyCtrlLL) {
137- if (bKeyboardHookLLProcSub()) {
138- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_ONLY_CTRLUP, (0x80000000 | (0xff000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24))));
139- }
136+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_ONLY_CTRLUP, (0x80000000 | (0xff000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24))));
140137 }
141138 bOnlyCtrlLL = FALSE;
142139 break;
143140 case VK_RETURN: // Enter (0x0d)
144141 bOnlyCtrlLL = FALSE;
145- if (bKeyboardHookLLProcSub()) {
146- if (bStartConvertingLL) {
147- bStartConvertingLL = FALSE;
148- PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (LPARAM)(DWORD)(WM_USER + lpstKBH->vkCode));
149- }
150- else {
151- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_RETURN, (0x80000000 | (0xff000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24))));
152- }
142+ if (bStartConvertingLL) {
143+ bStartConvertingLL = FALSE;
144+ PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (LPARAM)(DWORD)(WM_USER + lpstKBH->vkCode));
145+ }
146+ else {
147+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_RETURN, (0x80000000 | (0xff000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24))));
153148 }
154149 break;
155150 case VK_TAB: // Tab (0x09)
@@ -183,48 +178,32 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
183178 case VK_F9: // (0x78)
184179 case VK_F10: // (0x79)
185180 //case VK_NUMLOCK: // Num Lock (0x90)
186- case VK_OEM_ATTN: // OEM 英数/CapsLock (0xf0)
187- case VK_OEM_COPY: // OEM ひらがな (0xf2)
188181 //case VK_OEM_AUTO: // OEM 半角/全角 (0xf3 = VK_OEM_IME_OFF)
189182 case VK_OEM_IME_OFF: // OEM IME OFF (0xf3)
190183 case VK_OEM_IME_ON: // OEM IME ON (0xf4)
191184 case VK_OEM_BACKTAB: // OEM Alt+カタカナ/ひらがな (0xf5)
192185 case VK_OEM_PA1: // US(ENG) Non Convert (0xeb)
193186 bOnlyCtrlLL = FALSE;
194- if (bKeyboardHookLLProcSub()) {
187+ if (!bStartConvertingLL) {
195188 PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
196189 }
197190 break;
191+ case VK_OEM_ATTN: // OEM 英数/CapsLock (0xf0)
198192 case VK_OEM_FINISH: // OEM カタカナ (0xf1)
193+ case VK_OEM_COPY: // OEM ひらがな (0xf2)
199194 bOnlyCtrlLL = FALSE;
200- if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
201- if (bKeyboardHookLLProcSub()) {
202- //if (!bEnableEPHelperLL) break;
203- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
204- return 1;
205- }
206- }
207195 break;
208196 case VK_FF: // US(ENG) Convert
209197 bOnlyCtrlLL = FALSE;
198+ if (!bEnableEPHelperLL) break;
210199 if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
211- if (bKeyboardHookLLProcSub()) {
212- if (!bEnableEPHelperLL) break;
213- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (KEY_OEM_FINISH), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
214- return 1;
215- }
200+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (KEY_OEM_FINISH), ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
216201 }
217202 else if (lpstKBH->scanCode == 0x70) {
218- if (bKeyboardHookLLProcSub()) {
219- if (!bEnableEPHelperLL) break;
220- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_COPY, ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
221- }
203+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_COPY, ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
222204 }
223205 else if (lpstKBH->scanCode == 0x79) {
224- if (bKeyboardHookLLProcSub()) {
225- if (!bEnableEPHelperLL) break;
226- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_CONVERT, ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
227- }
206+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_CONVERT, ((0x80000000 | 0xff000000 & (static_cast<LPARAM>(lpstKBH->flags)) << 24)));
228207 }
229208 break;
230209 default:
@@ -253,55 +232,58 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
253232 case VK_CAPITAL: // 英数/CapsLock (0x14)
254233 bOnlyCtrlLL = FALSE;
255234 bStartConvertingLL = FALSE;
235+ dwPreviousVKLL = 0;
236+ if (!bEnableEPHelperLL) break;
256237 if (bKBisEP()) {
257- dwPreviousVKLL = VK_OEM_ATTN;
258- if (bKeyboardHookLLProcSub()) {
259- if (!bEnableEPHelperLL) break;
260- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_ATTN, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
261- }
238+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_OEM_ATTN, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
262239 return 1;
263240 }
264241 break;
265242 case VK_KANJI: // JP(IME/ENG) Alt + 漢字 (0x19)
266243 bOnlyCtrlLL = FALSE;
267244 bStartConvertingLL = FALSE;
268- dwPreviousVKLL = VK_KANJI;
245+ dwPreviousVKLL = 0;
269246 if (GetAsyncKeyState(VK_MENU) & 0x8000) {
270- if (bKeyboardHookLLProcSub()) {
271- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_KANJI, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
272- }
273- return 1;
247+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, KEY_KANJI, (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
274248 }
275249 break;
276250 case VK_OEM_3: // JP(IME/ENG) [@] / US(ENG) IME ON (0xc0) = ['] ALT + 半角/全角 or 漢字
277251 case VK_OEM_8: // JP(IME/ENG) [`] / British(ENG) IME ON (0xdf) = ['] ALT + 半角/全角 or 漢字
278252 bOnlyCtrlLL = FALSE;
279253 bStartConvertingLL = FALSE;
254+ if (!bEnableEPHelperLL) break;
280255 if (bKBisEP()) {
281- if (bKeyboardHookLLProcSub()) {
282- PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (WM_USER + lpstKBH->vkCode));
283- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
284- }
256+ PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (WM_USER + lpstKBH->vkCode));
257+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
285258 return 1;
286259 }
287260 break;
288261 case VK_OEM_ATTN: // OEM 英数/CapsLock (0xf0)
262+ bOnlyCtrlLL = FALSE;
263+ bStartConvertingLL = FALSE;
264+ dwPreviousVKLL = 0;
265+ if (!bStartConvertingLL) {
266+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
267+ }
268+ break;
289269 case VK_OEM_FINISH: // OEM カタカナ (0xf1)
290270 case VK_OEM_COPY: // OEM ひらがな (0xf2)
291271 bOnlyCtrlLL = FALSE;
292272 bStartConvertingLL = FALSE;
293- if (bKeyboardHookLLProcSub()) {
294- PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (WM_USER + lpstKBH->vkCode), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
273+ dwPreviousVKLL = 0;
274+ if (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
275+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (KEY_OEM_FINISH), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
276+ }
277+ else {
278+ PostMessage(hWndKBParentLL, WM_SYSKEYDOWNUPEX, (KEY_OEM_COPY), (0x7f000000 & (static_cast<LPARAM>(lpstKBH->flags) << 24)));
295279 }
296280 break;
281+ case VK_RETURN: // RETURN (0x0d)
297282 case VK_ESCAPE: // ESC (0x1b)
298- case VK_NONCONVERT: // 無変換 (0x1d)
299283 case VK_INSERT: // INSERT (0x2d)
300284 bOnlyCtrlLL = FALSE;
301285 bStartConvertingLL = FALSE;
302- if (bKeyboardHookLLProcSub()) {
303- PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (LPARAM)(DWORD)(WM_USER + lpstKBH->vkCode));
304- }
286+ PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (LPARAM)(DWORD)(WM_USER + lpstKBH->vkCode));
305287 break;
306288 default:
307289 bOnlyCtrlLL = FALSE;
@@ -313,9 +295,7 @@ static LRESULT CALLBACK lpKeyboardHookLLProc(int nCode, WPARAM wParam, LPARAM lP
313295 || ((0xdb <= lpstKBH->vkCode) && (lpstKBH->vkCode <= 0xde)) // 「[ {」「\ |」「- =」「^ ~」
314296 || ((lpstKBH->vkCode == 0xe2))) { // 「\ _」
315297 bStartConvertingLL = TRUE;
316- if (bKeyboardHookLLProcSub()) {
317- PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (WM_USER + lpstKBH->vkCode));
318- }
298+ PostMessage(hWndKBParentLL, WM_CHECKIMESTARTCONVEX, (WPARAM)bStartConvertingLL, (WM_USER + lpstKBH->vkCode));
319299 }
320300 else bStartConvertingLL = FALSE;
321301 }
@@ -364,19 +344,5 @@ static BOOL bKBisEP()
364344 #undef VALUE
365345 }
366346
367-//
368-// bKeyboardHookProcSub
369-//
370-static BOOL bKeyboardHookLLProcSub()
371-{
372- if (lpDatKeyboardLL == NULL) {
373- if ((lpDatKeyboardLL = (LPKEYBOARDLL_SHAREDMEM)CSharedMemLL->lpvSharedMemoryRead()) == NULL) {
374- return FALSE;
375- }
376- }
377- hWndKBParentLL = lpDatKeyboardLL->hWnd;
378- bEnableEPHelperLL = lpDatKeyboardLL->bEnableEPHelper;
379- return TRUE;
380-}
381347
382348 /* = EOF = */
\ No newline at end of file
--- /dev/null
+++ b/FlushMouseDLL/MouseHookDll.cpp
@@ -0,0 +1,122 @@
1+// MouseHookDll.cpp
2+// Copyright (C) 2022 JeffyTS
3+//
4+// No. Date Name Reason & Document
5+// -------+-----------+-----------+-------------------------------------------- -
6+// #0000 2022/02/12 JeffyTS New edit.
7+//
8+
9+//
10+// Include
11+//
12+#pragma once
13+#include "pch.h"
14+#include "MouseHookDll.h"
15+#include "..\FlushMouseLIB\CommonDef.h"
16+
17+//
18+// Define
19+//
20+
21+//
22+// Local Prototype Define
23+//
24+static LRESULT CALLBACK lpMouseHookProc(int nCode, WPARAM wParam, LPARAM lParam);
25+
26+//
27+// Local Data
28+//
29+#pragma comment( linker, "/SECTION:FLUSHMOUSEDLL_SEG,RWS" )
30+#pragma data_seg("FLUSHMOUSEDLL_SEG")
31+static HWND hWndMSParent = NULL;
32+static LPMOUSE_SHAREDMEM lpDatMouse = NULL;
33+static CSharedMemory* CSharedMem = NULL;
34+#pragma data_seg()
35+
36+//
37+// bMouseHookSet()
38+//
39+DLLEXPORT BOOL __stdcall bMouseHookSet(HWND hWnd)
40+{
41+ hWndMSParent = hWnd;
42+ if ((CSharedMem = new CSharedMemory(MOUSEHOOKMEM, sizeof(MOUSE_SHAREDMEM))) != NULL) {
43+ if ((lpDatMouse = (LPMOUSE_SHAREDMEM)CSharedMem->lpvSharedMemoryRead()) != NULL) {
44+ lpDatMouse->hWnd = hWnd;
45+ if (CSharedMem->bSharedMemoryWrite(lpDatMouse)) {
46+ HHOOK hHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)lpMouseHookProc, hGetInstance(), 0);
47+ if (hHook) {
48+ lpDatMouse->hHook = hHook;
49+ if (CSharedMem->bSharedMemoryWrite(lpDatMouse)) {
50+ return TRUE;
51+ }
52+ UnhookWindowsHookEx(hHook);
53+ }
54+ }
55+ }
56+ delete CSharedMem;
57+ CSharedMem = NULL;
58+ hWndMSParent = NULL;
59+ lpDatMouse = NULL;
60+ }
61+ return FALSE;
62+}
63+
64+//
65+// bMouseHookUnset()
66+//
67+DLLEXPORT BOOL __stdcall bMouseHookUnset()
68+{
69+ BOOL bRet = FALSE;
70+ if (CSharedMem != NULL) {
71+ if ((lpDatMouse = (LPMOUSE_SHAREDMEM)CSharedMem->lpvSharedMemoryRead()) != NULL) {
72+ if (lpDatMouse->hHook) {
73+ if (UnhookWindowsHookEx(lpDatMouse->hHook)) {
74+ bRet = TRUE;
75+ }
76+ }
77+ }
78+ delete CSharedMem;
79+ CSharedMem = NULL;
80+ hWndMSParent = NULL;
81+ lpDatMouse = NULL;
82+ }
83+ return bRet;
84+}
85+
86+//
87+// lpMouseHookProc()
88+//
89+template<typename T1, typename T2>
90+constexpr DWORD WORD2DWORD(T1 h, T2 l) { return (DWORD)(((((DWORD)(l)) << 16) & 0xffff0000) | ((DWORD)(h) & 0xffff)); }
91+
92+static LRESULT CALLBACK lpMouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
93+{
94+ if (nCode < 0) {
95+ return CallNextHookEx(NULL, nCode, wParam, lParam);
96+ }
97+
98+ if ((nCode == HC_ACTION) || (nCode == HC_NOREMOVE)) {
99+ switch (wParam) {
100+ case WM_LBUTTONDOWN:
101+ case WM_RBUTTONDOWN:
102+ case WM_LBUTTONUP:
103+ case WM_RBUTTONUP:
104+ case WM_NCLBUTTONDOWN:
105+ case WM_NCRBUTTONDOWN:
106+ case WM_NCLBUTTONUP:
107+ case WM_NCRBUTTONUP:
108+ {
109+ MOUSEHOOKSTRUCT* mh = (MOUSEHOOKSTRUCT*)lParam;
110+ DWORD pt = WORD2DWORD(mh->pt.x, mh->pt.y);
111+ PostMessage(hWndMSParent, (UINT)(WM_USER + wParam), (WPARAM)mh->hwnd, (LPARAM)pt);
112+ }
113+ break;
114+ default:
115+ break;
116+ }
117+ }
118+ return CallNextHookEx(NULL, nCode, wParam, lParam);
119+}
120+
121+
122+/* = EOF = */
\ No newline at end of file
--- /dev/null
+++ b/FlushMouseDLL/MouseHookDll.h
@@ -0,0 +1,31 @@
1+// MouseHookDll.h
2+// Copyright (C) 2022 JeffyTS
3+//
4+// No. Date Name Reason & Document
5+// -------+-----------+-----------+-------------------------------------------- -
6+// #0000 2022/02/12 JeffyTS New edit.
7+//
8+
9+//
10+// Include
11+//
12+#pragma once
13+#include "FlushMouseDll.h"
14+#include "..\MiscLIB\CSharedMemory.h"
15+
16+//
17+// Define
18+//
19+#define MOUSEHOOKMEM _T("MouseHookSharedMem")
20+typedef struct tagMOUSE_SHAREDMEM {
21+ HWND hWnd;
22+ HHOOK hHook;
23+} MOUSE_SHAREDMEM, * PMOUSE_SHAREDMEM, * LPMOUSE_SHAREDMEM;
24+
25+//
26+// Global Prototype Define
27+//
28+DLLEXPORT BOOL __stdcall bMouseHookSet(HWND hWnd);
29+DLLEXPORT BOOL __stdcall bMouseHookUnset(void);
30+
31+/* = EOF = */
--- a/FlushMouseDLL/ShellHookDll.cpp
+++ b/FlushMouseDLL/ShellHookDll.cpp
@@ -108,10 +108,10 @@ static LRESULT CALLBACK lpShellHookProc(int nCode, WPARAM wParam, LPARAM lParam)
108108 }
109109 switch (nCode) {
110110 case HSHELL_LANGUAGE:
111- PostMessage(FindWindow(CLASS_FLUSHMOUSE, NULL), WM_INPUTLANGCHANGEEX, wParam, lParam);
111+ PostMessage(hWndShellParent, WM_INPUTLANGCHANGEEX, wParam, lParam);
112112 break;
113113 }
114- return (LRESULT)0;
114+ return CallNextHookEx(NULL, nCode, wParam, lParam);
115115 }
116116
117117
--- a/FlushMouseDLL32/FlushMouseDLL32.vcxproj
+++ b/FlushMouseDLL32/FlushMouseDLL32.vcxproj
@@ -109,6 +109,7 @@
109109 <GenerateDebugInformation>true</GenerateDebugInformation>
110110 <EnableUAC>false</EnableUAC>
111111 <AdditionalDependencies>..\$(Platform)\$(Configuration)\MiscLIB32.lib;%(AdditionalDependencies)</AdditionalDependencies>
112+ <UACUIAccess>false</UACUIAccess>
112113 </Link>
113114 <PostBuildEvent>
114115 <Command>copy ..\$(Platform)\$(Configuration)\FlushMouseDLL32.dll ..\x64\$(Configuration)\</Command>
@@ -135,6 +136,7 @@
135136 <GenerateDebugInformation>true</GenerateDebugInformation>
136137 <EnableUAC>false</EnableUAC>
137138 <AdditionalDependencies>..\$(Platform)\$(Configuration)\MiscLIB32.lib;%(AdditionalDependencies)</AdditionalDependencies>
139+ <UACUIAccess>false</UACUIAccess>
138140 </Link>
139141 <PostBuildEvent>
140142 <Command>copy ..\$(Platform)\$(Configuration)\FlushMouseDLL32.dll ..\x64\$(Configuration)\</Command>
@@ -154,6 +156,7 @@
154156 <SubSystem>Windows</SubSystem>
155157 <GenerateDebugInformation>true</GenerateDebugInformation>
156158 <EnableUAC>false</EnableUAC>
159+ <UACUIAccess>false</UACUIAccess>
157160 </Link>
158161 </ItemDefinitionGroup>
159162 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -175,6 +178,7 @@
175178 <OptimizeReferences>true</OptimizeReferences>
176179 <GenerateDebugInformation>false</GenerateDebugInformation>
177180 <EnableUAC>false</EnableUAC>
181+ <UACUIAccess>false</UACUIAccess>
178182 </Link>
179183 </ItemDefinitionGroup>
180184 <ItemGroup>
--- a/FlushMouseDLL32/FlushMouseDLL32.vcxproj.filters
+++ b/FlushMouseDLL32/FlushMouseDLL32.vcxproj.filters
@@ -27,10 +27,10 @@
2727 <ClInclude Include="resource.h">
2828 <Filter>ヘッダー ファイル</Filter>
2929 </ClInclude>
30- <ClInclude Include="MouseHookDll32.h">
30+ <ClInclude Include="..\FlushMouse\CommonDef.h">
3131 <Filter>ヘッダー ファイル</Filter>
3232 </ClInclude>
33- <ClInclude Include="..\FlushMouse\CommonDef.h">
33+ <ClInclude Include="MouseHookDll32.h">
3434 <Filter>ヘッダー ファイル</Filter>
3535 </ClInclude>
3636 </ItemGroup>
--- a/FlushMouseDLL32/MouseHookDll32.cpp
+++ b/FlushMouseDLL32/MouseHookDll32.cpp
@@ -12,6 +12,7 @@
1212 #pragma once
1313 #include "pch.h"
1414 #include "MouseHookDll32.h"
15+#include "..\FlushMouseLIB\CommonDef.h"
1516
1617 //
1718 // Define
@@ -21,7 +22,6 @@
2122 // Local Prototype Define
2223 //
2324 static LRESULT CALLBACK lpMouseHookProc(int nCode, WPARAM wParam, LPARAM lParam);
24-static BOOL bMouseHookProcSub();
2525
2626 //
2727 // Local Data
@@ -91,47 +91,32 @@ constexpr DWORD WORD2DWORD(T1 h, T2 l) { return (DWORD)(((((DWORD)(l)) << 16) &
9191
9292 static LRESULT CALLBACK lpMouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
9393 {
94- if (nCode < 0) { // nCodeが0より小さい場合は関係ないので次に渡す
94+ if (nCode < 0) {
9595 return CallNextHookEx(NULL, nCode, wParam, lParam);
9696 }
9797
9898 if (nCode == HC_ACTION) {
99- if (lParam) {
100- switch (wParam) {
101- case WM_LBUTTONDOWN:
102- case WM_RBUTTONDOWN:
103- case WM_LBUTTONUP:
104- case WM_RBUTTONUP:
105- case WM_NCLBUTTONDOWN:
106- case WM_NCRBUTTONDOWN:
107- case WM_NCLBUTTONUP:
108- case WM_NCRBUTTONUP:
109- if (bMouseHookProcSub()) {
110- MOUSEHOOKSTRUCT* mh = (MOUSEHOOKSTRUCT*)lParam;
111- DWORD pt = WORD2DWORD(mh->pt.x, mh->pt.y);
112- PostMessage(hWndMSParent, (UINT)(WM_USER + wParam), (WPARAM)mh->hwnd, (LPARAM)pt);
113- }
114- break;
115- default:
116- break;
117- }
99+ switch (wParam) {
100+ case WM_LBUTTONDOWN:
101+ case WM_RBUTTONDOWN:
102+ case WM_LBUTTONUP:
103+ case WM_RBUTTONUP:
104+ case WM_NCLBUTTONDOWN:
105+ case WM_NCRBUTTONDOWN:
106+ case WM_NCLBUTTONUP:
107+ case WM_NCRBUTTONUP:
108+ {
109+ MOUSEHOOKSTRUCT* mh = (MOUSEHOOKSTRUCT*)lParam;
110+ DWORD pt = WORD2DWORD(mh->pt.x, mh->pt.y);
111+ PostMessage(hWndMSParent, (UINT)(WM_USER + wParam), (WPARAM)mh->hwnd, (LPARAM)pt);
112+ }
113+ break;
114+ default:
115+ break;
118116 }
119117 }
120118 return CallNextHookEx(NULL, nCode, wParam, lParam);
121119 }
122120
123-//
124-// bMouseHookProcSub
125-//
126-static BOOL bMouseHookProcSub()
127-{
128- if (lpDatMouse == NULL) {
129- if ((lpDatMouse = (LPMOUSE_SHAREDMEM32)CSharedMem->lpvSharedMemoryRead()) == NULL) {
130- return FALSE;
131- }
132- }
133- hWndMSParent = lpDatMouse->hWnd;
134- return TRUE;
135-}
136121
137122 /* = EOF = */
\ No newline at end of file
--- a/FlushMouseLIB/CommonDef.h
+++ b/FlushMouseLIB/CommonDef.h
@@ -103,7 +103,7 @@ typedef struct tagSIZED
103103 #define WM_CHECKEXISTINGJPIMEEX (WM_USER + 0x0003)
104104 #define HANDLE_WM_CHECKEXISTINGJPIMEEX(hWnd, wParam, lParam, fn) ((fn)((hWnd), (BOOL)(wParam)), 0L)
105105
106-// void Cls_OnCheckIMEStartConversioningEx(HWND hWnd, BOOL bStartConversioning, DWORD vkCode);
106+// void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConverting, DWORD vkCode);
107107 #define WM_CHECKIMESTARTCONVEX (WM_USER + 0x0004)
108108 #define HANDLE_WM_CHECKIMESTARTCONVEX(hWnd, wParam, lParam, fn) ((fn)((hWnd), (BOOL)(wParam), (DWORD)(lParam)), 0L)
109109
--- a/FlushMouseLIB/Cursor.cpp
+++ b/FlushMouseLIB/Cursor.cpp
@@ -638,13 +638,13 @@ BOOL CCursor::_bAdjustCaretByMonitorDPI(int iModeSizeX, int iModeSizeY, LPRECT
638638 //
639639 BOOL CCursor::bDrawIMEModeOnDisplaySub(LPIMECURSORDATA lpstCursorData)
640640 {
641- Sleep(50);
641+ Sleep(300);
642642
643- BOOL bFoundCaret = FALSE;
644- RECT rcCursor{}, rcCaret{};
643+ BOOL bFoundCaret = FALSE;
644+ RECT rcCursor{}, rcCaret{};
645645 int iCursorSizeX = 0, iCursorSizeY = 0, iCaretSizeX = 0, iCaretSizeY = 0;
646646 DWORD dwIMEModeCursor = IMEOFF, dwIMEModeCaret = IMEOFF;
647- HWND hCaretWnd = NULL;
647+ HWND hCaretWnd = NULL;
648648 if (lpstCursorData->bDrawNearCaret != FALSE) {
649649 if (lpstCursorData->hWnd != NULL) {
650650 rcCaret.left = lpstCursorData->rcCaret.left; rcCaret.top = lpstCursorData->rcCaret.top;
@@ -1044,7 +1044,6 @@ void CCursorWindow::Cls_OnPaint(HWND hWnd)
10441044 if ((hFontPrev = (HFONT)SelectObject(hDC, hFont)) != NULL) {
10451045 if (DrawTextEx(hDC, lpszMode, -1, &rc, DT_RIGHT | DT_SINGLELINE | DT_VCENTER, NULL) == 0) {
10461046 }
1047- SelectObject(hDC, hFontPrev);
10481047 }
10491048 DeleteObject(hFont);
10501049 }
--- a/FlushMouseLIB/FlushMouseLIB.cpp
+++ b/FlushMouseLIB/FlushMouseLIB.cpp
@@ -110,7 +110,7 @@ static void Cls_OnLButtonDownEx(HWND hWnd, int x, int y, HWND hForeground);
110110 static void Cls_OnLButtonUpEx(HWND hWnd, int x, int y, HWND hForeground);
111111 static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UINT flags);
112112 static void Cls_OnEventForegroundEx(HWND hWnd, DWORD dwEvent, HWND hForeWnd);
113-static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConversioning, DWORD vkCode);
113+static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConverting, DWORD vkCode);
114114 static void Cls_OnCheckExistingJPIMEEx(HWND hWnd, BOOL bEPHelper);
115115 static void Cls_OnInputLangChangeEx(HWND hWnd, UINT CodePage, HKL hkl);
116116
@@ -125,7 +125,7 @@ static BOOL CALLBACK bEnumChildProcChangeHKL(HWND hWnd, LPARAM lParam);
125125 //
126126 // bWinMain()
127127 //
128-BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance)
128+BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, int nCmdShow)
129129 {
130130 if (LoadString(Resource->hLoad(), IDS_APP_TITLE, szTitle, MAX_LOADSTRING) == 0) return FALSE;
131131
@@ -139,7 +139,7 @@ BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance)
139139 }
140140
141141 #define MessageBoxTYPE (MB_ICONSTOP | MB_OK)
142- HWND hWnd = NULL;
142+ HWND hWnd = NULL;
143143 if ((hWnd = FindWindow(CLASS_FLUSHMOUSE, NULL)) != NULL) {
144144 SetFocus(GetLastActivePopup(hWnd));
145145 PostMessage(hWnd, WM_DESTROY, NULL, NULL);
@@ -162,9 +162,11 @@ BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance)
162162 }
163163 }
164164
165- if ((hWnd = InitInstance(hInstance, SW_HIDE)) == NULL) {
165+ if ((hWnd = InitInstance(hInstance, nCmdShow)) == NULL) {
166166 return FALSE;
167167 }
168+ ShowWindow(hWnd, SW_HIDE);
169+ UpdateWindow(hWnd);
168170 hMainWnd = hWnd;
169171 return TRUE;
170172 }
@@ -226,7 +228,7 @@ static HWND InitInstance(HINSTANCE hInstance, int nCmdShow)
226228 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
227229 {
228230 #define HANDLE_WM_POWERBROADCAST(hWnd, wParam, lParam, fn) (LRESULT)(DWORD)(BOOL)((fn)((hWnd), (ULONG)(wParam), (POWERBROADCAST_SETTING *)(lParam)))
229-#define HANDLE_WM_INPUTLANGCHANGE(hWnd, wParam, lParam, fn) ((fn)((hWnd), (UINT)(wParam), (HKL)(lParam)), 0L)
231+//#define HANDLE_WM_INPUTLANGCHANGE(hWnd, wParam, lParam, fn) ((fn)((hWnd), (UINT)(wParam), (HKL)(lParam)), 0L)
230232
231233 switch (message) {
232234 HANDLE_MSG(hWnd, WM_CREATE, Cls_OnCreate);
@@ -310,8 +312,8 @@ static BOOL Cls_OnCreate(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
310312 return FALSE;
311313 }
312314
313- if ((bCheckExistingJPIME() && bEnableEPHelper) || bIMEModeForced) {
314- bForExplorerPatcherSWS(GetForegroundWindow(), TRUE, bIMEModeForced, NULL, NULL);
315+ if ((bCheckExistingJPIME() && bEnableEPHelper)) {
316+ bForExplorerPatcherSWS(GetForegroundWindow(), TRUE, TRUE, NULL, NULL);
315317 }
316318
317319 bReportEvent(MSG_START_SUCCEED, APPLICATION_CATEGORY);
@@ -418,8 +420,6 @@ static void Cls_OnDisplayChange(HWND hWnd, UINT bitsPerPixel, UINT cxScreen, UIN
418420 UNREFERENCED_PARAMETER(bitsPerPixel);
419421 UNREFERENCED_PARAMETER(cxScreen);
420422 UNREFERENCED_PARAMETER(cyScreen);
421- if (!Cime->bGetVirtualDesktopSize()) {
422- }
423423 }
424424
425425 //
@@ -430,13 +430,13 @@ static void Cls_OnInputLangChangeEx(HWND hWnd, UINT CodePage, HKL hkl)
430430 {
431431 UNREFERENCED_PARAMETER(hWnd);
432432 UNREFERENCED_PARAMETER(CodePage);
433- if ((bCheckExistingJPIME() && bEnableEPHelper) || bIMEModeForced) {
433+ if ((bCheckExistingJPIME() && bEnableEPHelper)) {
434434 if (hkl == US_ENG) {
435435 HWND hForeWnd = GetForegroundWindow();
436436 if (hForeWnd != NULL) {
437437 HKL hNewHKL = NULL;
438438 HKL hPreviousHKL = NULL;
439- bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL); // @@@ for Explorer Patcher Simple Window Switcher
439+ bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL);
440440 }
441441 }
442442 }
@@ -452,7 +452,7 @@ static void Cls_OnLButtonDownEx(HWND hWnd, int x, int y, HWND hForeground)
452452 UNREFERENCED_PARAMETER(x);
453453 UNREFERENCED_PARAMETER(y);
454454 UNREFERENCED_PARAMETER(hForeground);
455- if ((bCheckExistingJPIME() && bEnableEPHelper) || bIMEModeForced) {
455+ if ((bCheckExistingJPIME() && bEnableEPHelper)) {
456456 bForExplorerPatcherSWS(hForeground, FALSE, FALSE, NULL, NULL);
457457 }
458458 return;
@@ -472,8 +472,8 @@ static void Cls_OnLButtonUpEx(HWND hWnd, int x, int y, HWND hForeground)
472472 HWND hWndObserved = NULL;
473473 POINT pt{};
474474 if (GetCursorPos(&pt)) {
475- RECT rc{};
476- if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
475+ RECT rc{};
476+ if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
477477 if (FindWindow(L"Shell_TrayWnd", NULL) == GetForegroundWindow()) {
478478 if (bGetTaskTrayWindowRect(hWnd, &rc) == FALSE) return;
479479 if (((pt.x >= rc.left) && (pt.x <= rc.right)) || ((pt.y <= rc.top) && (pt.y >= rc.bottom))) return;
@@ -541,15 +541,7 @@ static void Cls_OnCheckIMEStartConvertingEx(HWND hWnd, BOOL bStartConverting, D
541541 UNREFERENCED_PARAMETER(hWnd);
542542 UNREFERENCED_PARAMETER(vkCode);
543543
544- HWND hWndObserved = GetForegroundWindow();
545- POINT pt{};
546- if (Cursor->bGetCaretPos(hWndObserved, &pt)) {
547- if ((pt.x != 0) && (pt.y != 0)) {
548- hWndObserved = WindowFromPoint(pt);
549- }
550- }
551- if (Cime->dwIMEMode(hWndObserved, FALSE) != IMEOFF) bIMEInConverting = bStartConverting;
552- else bIMEInConverting = FALSE;
544+ bIMEInConverting = bStartConverting;
553545 }
554546
555547 //
@@ -566,13 +558,36 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
566558 }
567559 HKL hNewHKL = NULL;
568560 HKL hPreviousHKL = NULL;
569- HWND hForeWnd = GetForegroundWindow();
561+ HWND hForeWnd = NULL;
570562 if ((fDown == FALSE)) { // Key up
571563 switch (vk) {
572564 case KEY_TAB:
573565 case KEY_RETURN:
574- break;
566+ if (!bIMEInConverting) {
567+ HWND hWndObserved = NULL;
568+ if (bDisplayFocusWindowIME) {
569+ if ((hWndObserved = GetForegroundWindow()) == NULL) return;
570+ }
571+ else {
572+ POINT pt{};
573+ if (GetCursorPos(&pt)) {
574+ if ((hWndObserved = WindowFromPoint(pt)) == NULL) return;
575+ }
576+ else return; // error
577+ }
578+ if (Cursor->bStartIMECursorChangeThread(hWndObserved)) {
579+ if (bDoModeDispByIMEKeyDown) {
580+ if (!bIMEInConverting) {
581+ if (!Cursor->bStartDrawIMEModeThreadWait(hWndObserved)) return;
582+ }
583+ }
584+ }
585+ return;
586+ }
587+ bIMEInConverting = FALSE;
588+ return;
575589 case KEY_ONLY_CTRLUP:
590+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
576591 if (bEnableEPHelper) bForExplorerPatcherSWS(hForeWnd, FALSE, FALSE, NULL, NULL);
577592 if (bDoModeDispByCtrlUp) {
578593 POINT pt{};
@@ -594,46 +609,56 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
594609 case KEY_F9: // F9 (0x78)
595610 case KEY_F10: // F10 (0x79)
596611 break;
597- case KEY_IME_ON: // IME ON (0x16)
598- bIMEInConverting = FALSE;
612+ case KEY_IME_ON: // IME ON (0x16)
613+ if (bIMEInConverting) {
614+ return;
615+ }
599616 if (bEnableEPHelper || bIMEModeForced) {
617+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
600618 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
601619 }
602620 break;
603621 case KEY_KANJI: // JP(IME/ENG) Alt + 漢字 (0x19)
604- bIMEInConverting = FALSE;
622+ if (bIMEInConverting) {
623+ return;
624+ }
605625 if (bEnableEPHelper || bIMEModeForced) {
626+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
606627 DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
607- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
608- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
609- if (dwBeforeIMEMode != IMEOFF) {
610- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
611- }
612- else {
613- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
614- }
628+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
629+ if (dwBeforeIMEMode != IMEOFF) {
630+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
631+ }
632+ else {
633+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
615634 }
616635 }
617636 }
618637 break;
619638 case KEY_IME_OFF: // IME OFF (0x1a)
620- bIMEInConverting = FALSE;
639+ if (bIMEInConverting) {
640+ return;
641+ }
621642 if (bEnableEPHelper || bIMEModeForced) {
622- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
623- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
624- }
643+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
644+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
625645 }
626646 break;
627647 case KEY_CONVERT: // JP(IME/ENG) 変換 (0x1c)
628- if (bIMEInConverting) return;
629- if (bEnableEPHelper || bIMEModeForced) {
630- SetFocus(hForeWnd);
631- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
632- if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
633- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
634- }
635- else {
636- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
648+ if (bIMEInConverting) {
649+ return;
650+ }
651+ if ((bEnableEPHelper || bIMEModeForced)) {
652+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
653+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
654+ if (dwBeforeIMEMode == IMEOFF) {
655+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
656+ if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
657+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
658+ Sleep(50);
659+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
660+ }
661+ else {
637662 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
638663 }
639664 }
@@ -641,19 +666,22 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
641666 }
642667 break;
643668 case KEY_NONCONVERT: // JP(IME/ENG) 無変換 (0x1d)
644- bIMEInConverting = FALSE;
669+ if (bIMEInConverting) {
670+ return;
671+ }
645672 if (bEnableEPHelper || bIMEModeForced) {
646- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
647- if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
648- if (((UINT64)hPreviousHKL & LANG_MASK) != LANG_IME) {
649- PostMessage(hWnd, WM_SYSKEYDOWNUPEX, KEY_OEM_PA1, (0x80000000));
650- }
651- else {
652- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
673+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
674+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
675+ if (dwBeforeIMEMode != IMEOFF) {
676+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, FALSE, &hNewHKL, &hPreviousHKL)) {
677+ if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
678+ if (((UINT64)hPreviousHKL & LANG_MASK) != LANG_IME) {
679+ PostMessage(hWnd, WM_SYSKEYDOWNUPEX, KEY_OEM_PA1, (0x80000000));
680+ }
653681 }
654682 }
655683 else {
656- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
684+ if ((dwBeforeIMEMode != IMEOFF)) {
657685 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
658686 }
659687 }
@@ -663,9 +691,12 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
663691 case KEY_OEM_3: // JP(IME/ENG) [@] / US(ENG) IME ON (0xc0) = ['] ALT + 半角/全角 or 漢字
664692 case KEY_OEM_8: // JP(IME/ENG) [`] / UK(ENG) IME ON (0xdf) = ['] ALT + 半角/全角 or 漢字
665693 if (!bKBisEP()) return;
666- if (bIMEInConverting) return;
694+ if (bIMEInConverting) {
695+ return;
696+ }
667697 if (bEnableEPHelper || bIMEModeForced) {
668- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
698+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
699+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
669700 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
670701 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
671702 }
@@ -675,24 +706,33 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
675706 }
676707 }
677708 break;
678- return;
679709 case KEY_OEM_PA1: // US(ENG) 無変換 (0xeb)
680- bIMEInConverting = FALSE;
710+ if (bIMEInConverting) {
711+ return;
712+ }
681713 if (bEnableEPHelper || bIMEModeForced) {
682- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
683- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
714+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
715+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
716+ if (dwBeforeIMEMode != IMEOFF) {
717+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
718+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
719+ }
684720 }
685721 }
686722 break;
687723 case KEY_OEM_ATTN: // JP(IME/ENG) 英数/CapsLock(0xf0)
688- if (bIMEInConverting) return;
724+ if (bIMEInConverting) {
725+ return;
726+ }
689727 if (bEnableEPHelper || bIMEModeForced) {
690- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
691- if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
692- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
693- }
694- else {
695- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
728+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
729+ DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
730+ if (dwBeforeIMEMode != IMEOFF) {
731+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
732+ if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
733+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
734+ }
735+ else {
696736 Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
697737 }
698738 }
@@ -700,72 +740,90 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
700740 }
701741 break;
702742 case KEY_OEM_FINISH: // JP(IME/ENG) OEM カタカナ (0xf1)
703- if (bIMEInConverting) return;
743+ if (bIMEInConverting) {
744+ return;
745+ }
704746 if (bEnableEPHelper || bIMEModeForced) {
705- if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
747+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
748+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
706749 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
750+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
751+ Sleep(50);
707752 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENKANA_IMEON);
708753 }
709754 else {
710- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
711- Cime->vIMEConvertModeChangeForced(hForeWnd, ZENKANA_IMEON);
712- }
755+ Cime->vIMEConvertModeChangeForced(hForeWnd, ZENKANA_IMEON);
713756 }
714757 }
715758 }
716759 break;
717760 case KEY_OEM_COPY: // JP(IME/ENG) OEM ひらがな (0xf2)
718- if (bIMEInConverting) return;
761+ if (bIMEInConverting) {
762+ return;
763+ }
719764 if (bEnableEPHelper || bIMEModeForced) {
720- if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
765+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
766+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
721767 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
768+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
769+ Sleep(50);
722770 Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
723771 }
724772 else {
725- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
726- Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
727- }
773+ Cime->vIMEConvertModeChangeForced(hForeWnd, ZENHIRA_IMEON);
728774 }
729775 }
730776 }
731777 break;
732- case KEY_OEM_IME_OFF: // JP(IME/ENG) IME OFF
733- bIMEInConverting = FALSE;
778+ case KEY_OEM_IME_OFF: // JP(IME/ENG) IME OFF (0xf3)
779+ if (bIMEInConverting) {
780+ return;
781+ }
734782 if (bEnableEPHelper || bIMEModeForced) {
783+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
735784 DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
736- if (bForExplorerPatcherSWS(hForeWnd, bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
785+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
737786 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
738787 if (dwBeforeIMEMode == IMEOFF) {
739788 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
740789 }
790+ else {
791+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
792+ }
741793 }
742794 else {
743- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
744- if (dwBeforeIMEMode != IMEOFF) {
745- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
746- }
795+ if (dwBeforeIMEMode != IMEOFF) {
796+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
797+ }
798+ else {
799+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
747800 }
748801 }
749802 }
750803 }
751804 break;
752- case KEY_OEM_IME_ON: // JP(IME/ENG) IME ON
753- bIMEInConverting = FALSE;
805+ case KEY_OEM_IME_ON: // JP(IME/ENG) IME ON (0xf4)
806+ if (bIMEInConverting) {
807+ return;
808+ }
754809 if (bEnableEPHelper || bIMEModeForced) {
810+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
755811 DWORD dwBeforeIMEMode = Cime->dwIMEMode(hForeWnd, FALSE);
756- if (bForExplorerPatcherSWS(GetForegroundWindow(), bIMEModeForced, TRUE, &hNewHKL, &hPreviousHKL)) {
812+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
757813 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
758- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
759- if (dwBeforeIMEMode == IMEOFF) {
760- Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
761- }
814+ if (dwBeforeIMEMode == IMEOFF) {
815+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
816+ }
817+ else {
818+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
762819 }
763820 }
764821 else {
765- if ((bIMEModeForced != FALSE) && (!Cime->bIsNewIME())) {
766- if (dwBeforeIMEMode != IMEOFF) {
767- Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
768- }
822+ if (dwBeforeIMEMode != IMEOFF) {
823+ Cime->vIMEOpenCloseForced(hForeWnd, IMECLOSE);
824+ }
825+ else {
826+ Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
769827 }
770828 }
771829 }
@@ -773,10 +831,13 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
773831 break;
774832 case KEY_OEM_BACKTAB: // OEM Alt+カタカナ/ひらがな (0xf5)
775833 case KEY_FF: // US(ENG) 変換/ひら/カタ (0xff)
776- bIMEInConverting = FALSE;
834+ if (bIMEInConverting) {
835+ return;
836+ }
777837 if (bEnableEPHelper || bIMEModeForced) {
838+ if ((hForeWnd = GetForegroundWindow()) == NULL) return;
778839 SetFocus(hForeWnd);
779- if (bForExplorerPatcherSWS(hForeWnd, TRUE, bIMEModeForced, &hNewHKL, &hPreviousHKL)) {
840+ if (bForExplorerPatcherSWS(hForeWnd, TRUE, TRUE, &hNewHKL, &hPreviousHKL)) {
780841 if ((hPreviousHKL != JP_IME) && (hNewHKL == JP_IME)) {
781842 Cime->vIMEOpenCloseForced(hForeWnd, IMEOPEN);
782843 }
@@ -806,7 +867,7 @@ static void Cls_OnSysKeyDownUpEx(HWND hWnd, UINT vk, BOOL fDown, int cRepeat, UI
806867 }
807868 HWND hWndObserved = NULL;
808869 if (bDisplayFocusWindowIME) {
809- hWndObserved = hForeWnd;
870+ if ((hWndObserved = GetForegroundWindow()) == NULL) return;
810871 }
811872 else {
812873 POINT pt{};
@@ -898,8 +959,6 @@ BOOL bForExplorerPatcherSWS(HWND hForeWnd, BOOL bChangeToIME, BOOL bIMEModeForc
898959 if ((bChangeToIME && (hkl != JP_IME)) || (hkl == US_ENG) || bIMEModeForcedChange) {
899960 hkl = JP_IME;
900961 if (ActivateKeyboardLayout(hkl, (KLF_SETFORPROCESS | KLF_REORDER)) != 0) {
901- //EnumChildWindows(hForeWnd, &bEnumChildProcChangeHKL, (LPARAM)hkl);
902- //Cime->vActivateIME(hForeWnd);
903962 if ((hkl = GetKeyboardLayout(dwThreadID)) != NULL) { // Re Check
904963 if (hkl != JP_IME) {
905964 if (bChangeHKLbySendInput(JP_IME, hkl)) {
@@ -942,10 +1001,8 @@ BOOL bChangeHKLbySendInput(HKL hNewHKL, HKL hPreviousHKL)
9421001 if (lpHKL[i] == hPreviousHKL) iPreviousKB = i;
9431002 if (lpHKL[i] == hNewHKL) iNewKB = i;
9441003 }
945- while (GetAsyncKeyState(VK_SHIFT) & 0x8000) {
946- Sleep(1);
947- }
9481004 int iKB = iKBList - iPreviousKB + iNewKB;
1005+ if ((GetAsyncKeyState(VK_SHIFT) & 0x8000)) iKB = iKBList - iKB;
9491006 if (iNewKB != iPreviousKB) {
9501007 LPINPUT lpInputs = NULL;
9511008 if ((lpInputs = new INPUT[sizeof(INPUT) * (iKB * 2 + 2)]) != NULL) {
--- a/FlushMouseLIB/FlushMouseLIB.h
+++ b/FlushMouseLIB/FlushMouseLIB.h
@@ -32,7 +32,7 @@ private:
3232
3333 public:
3434 HMODULE hLoad();
35- BOOL bUnload();
35+ BOOL bUnload();
3636
3737 private:
3838 LPTSTR szResFile;
@@ -44,7 +44,7 @@ private:
4444 //
4545 // Global Prototype Define
4646 //
47-extern BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance);
47+extern BOOL bWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, int nCmdShow);
4848 extern VOID vDestroyWindow(HWND hWnd);
4949 extern BOOL bStartThreadHookTimer(HWND hWnd);
5050 extern VOID vStopThreadHookTimer(HWND hWnd);
@@ -55,10 +55,10 @@ extern BOOL bCheckExistingJPIME();
5555 //
5656 // Global Data
5757 //
58-extern TCHAR szFlushMouseDLL[];
59-extern TCHAR szFlushMouse32[];
58+extern TCHAR szFlushMouseDLL[];
59+extern TCHAR szFlushMouse32[];
6060
61-extern TCHAR szTitle[];
61+extern TCHAR szTitle[];
6262 extern HWND hMainWnd;
6363
6464 extern BOOL bOffChangedFocus;
@@ -74,7 +74,7 @@ extern BOOL bIMEModeForced;
7474
7575 extern CProfile *Profile;
7676 extern CCursor *Cursor;
77-extern CResource *Resource;
77+extern CResource *Resource;
7878 extern CIME *Cime;
7979
8080 /* = EOF = */
\ No newline at end of file
--- a/FlushMouseLIB/FlushMouseSub.cpp
+++ b/FlushMouseLIB/FlushMouseSub.cpp
@@ -17,6 +17,7 @@
1717 #include "CommonDef.h"
1818 #include "..\FlushMouseDLL\ShellHookDll.h"
1919 #include "..\FlushMouseDLL\GlobalHookDll.h"
20+#include "..\FlushMouseDLL\MouseHookDll.h"
2021 #include "..\FlushMouseDLL\KeyboardHookDll.h"
2122 #include "..\FlushMouseDLL\EventlogDll.h"
2223 #include "..\FlushMouseDLL32\FlushMouseDll32.h"
@@ -44,6 +45,7 @@
4445 //
4546 CPowerNotification::CPowerNotification(HWND hWnd)
4647 {
48+ guidPowerSettingNotification = GUID_NULL;
4749 if ((hSuspendResumeNotification = RegisterSuspendResumeNotification(hWnd, DEVICE_NOTIFY_WINDOW_HANDLE)) == NULL) {
4850 }
4951 if ((hPowerSettingNotification = RegisterPowerSettingNotification(hWnd, &guidPowerSettingNotification, DEVICE_NOTIFY_WINDOW_HANDLE)) == NULL) {
@@ -83,7 +85,9 @@ BOOL CPowerNotification::PowerBroadcast(HWND hWnd, ULONG Type, POWERBROADCAST_S
8385 bReportEvent(MSG_PBT_APMRESUMEAUTOMATIC, POWERNOTIFICATION_CATEGORY);
8486 break;
8587 case PBT_APMRESUMESUSPEND:
88+ bDestroyTaskTrayWindow(hWnd);
8689 bReportEvent(MSG_PBT_APMRESUMESUSPEND, POWERNOTIFICATION_CATEGORY);
90+ PostMessage(hWnd, WM_DESTROY, (WPARAM)NULL, (LPARAM)NULL);
8791 break;
8892 case PBT_POWERSETTINGCHANGE:
8993 bReportEvent(MSG_PBT_POWERSETTINGCHANGE, POWERNOTIFICATION_CATEGORY);
@@ -298,7 +302,7 @@ BOOL CFlushMouseHook::bHookUnset()
298302 BOOL CFlushMouseHook::bHook32DllStart(HWND hWnd, LPCTSTR lpszExec32Name)
299303 {
300304 #define COMAMANDLINESIZE (sizeof(_T(" ")) * (sizeof(unsigned long long) + 1))
301- BOOL bRet = FALSE;
305+ BOOL bRet = FALSE;
302306 DWORD dwSize = 0;
303307 dwSize = ExpandEnvironmentStrings(lpszExec32Name, NULL, 0);
304308 LPTSTR lpszBuffer = new TCHAR[dwSize];
--- a/FlushMouseLIB/Ime.cpp
+++ b/FlushMouseLIB/Ime.cpp
@@ -42,8 +42,6 @@ CIME::CIME()
4242 {
4343 lpstVirtualDesktop = new VIRTUALDESKTOP[sizeof(VIRTUALDESKTOP)];
4444 if (lpstVirtualDesktop != NULL) {
45- ZeroMemory(lpstVirtualDesktop, sizeof(VIRTUALDESKTOP));
46- bGetVirtualDesktopSize();
4745 }
4846 }
4947 CIME::~CIME()
--- a/FlushMouseLIB/Ime.h
+++ b/FlushMouseLIB/Ime.h
@@ -3,8 +3,8 @@
33 //
44 // No. Date Name Reason & Document
55 // -------+-----------+-----------+-------------------------------------------- -
6-// #0000 2022/03/12 JeffyTS New edit.
7-// #0001 2023/06/30 JeffyTS Divided from cursor.h
6+// #0000 2022/03/12 JeffyTS New edit.
7+// #0001 2023/06/30 JeffyTS Divided from cursor.h
88
99 //
1010 // Include
@@ -18,22 +18,22 @@
1818 #define IMEMODECHAR 3
1919
2020 // IME mode
21-#define IMECLOSE 0x0000
21+#define IMECLOSE 0x0000
2222 #define IMEOPEN 0x0001
23-#define IMEOFF (IME_CMODE_ALPHANUMERIC) // 0x00 : A 英数(直接入力)
23+#define IMEOFF (IME_CMODE_ALPHANUMERIC) // 0x00 : A 英数(直接入力)
2424 #define HANEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_ALPHANUMERIC) // 0x10 :_A 半角英数 0001 0000
2525 #define HANKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x13 :_カ 半角カナ 0001 0011
2626 #define ZENEISU_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE) // 0x18 :A 全角英数 0001 1000
2727 #define ZENHIRA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_NATIVE) // 0x19 :あ 全角ひら 0001 1001(漢字変換モード)
2828 #define ZENKANA_IMEON (IME_CMODE_ROMAN | IME_CMODE_FULLSHAPE | IME_CMODE_KATAKANA | IME_CMODE_NATIVE) // 0x1B :カ 全角カナ 0001 1011
29-#define IMEHIDE (0x88) // 0x88 :■ Hide 1001 1000
29+#define IMEHIDE (0x88) // 0x88 :■ Hide 1000 1000
3030
3131 //
3232 // Struct Define
3333 //
3434 typedef struct tagVirtualDesktop
3535 {
36- RECT rcMonitorSize;
36+ RECT rcMonitorSize;
3737 int iNumOfMonitors;
3838 } VIRTUALDESKTOP, * PVIRTUALDESKTOP, * LPVIRTUALDESKTOP;
3939
@@ -47,18 +47,18 @@ public:
4747 ~CIME();
4848
4949 public:
50- BOOL bIsIMEOpen(HWND hWndObserved);
51- VOID vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose);
52- VOID vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode);
50+ BOOL bIsIMEOpen(HWND hWndObserved);
51+ VOID vIMEOpenCloseForced(HWND hWndObserved, DWORD dwIMEOpenClose);
52+ VOID vIMEConvertModeChangeForced(HWND hWndObserved, DWORD dwConvertMode);
5353 DWORD dwIMEMode(HWND hWndObserved, BOOL bForceHiragana);
54- VOID vActivateIME(HWND hWndObserved);
55- BOOL bGetVirtualDesktopSize();
56- BOOL bIsNewIME();
54+ VOID vActivateIME(HWND hWndObserved);
55+ BOOL bGetVirtualDesktopSize();
56+ BOOL bIsNewIME();
5757 DWORD dwGetInputLocale();
5858 HKL hklGetInputLocale(HWND hWndObserved);
5959
6060 private:
61- static BOOL bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
61+ static BOOL bGetVirtualDesktopSizeEnumProc(HMONITOR hMonitor, HDC hDC, LPCRECT lprcClip, LPARAM lParam);
6262
6363 static BOOL CALLBACK bEnumChildProcIMEOpenClose(HWND hWnd, LPARAM lParam);
6464 static BOOL CALLBACK bEnumChildProcIMEConvertMode(HWND hWnd, LPARAM lParam);
--- a/FlushMouseLIB/TaskTray.cpp
+++ b/FlushMouseLIB/TaskTray.cpp
@@ -4,8 +4,8 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/03/03 JeffyTS New edit.
8-// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.cpp
7+// #0000 2022/03/03 JeffyTS New edit.
8+// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.cpp
99 //
1010
1111 // Include
@@ -51,7 +51,7 @@ static BOOL bInitDlgCenter(HWND hDlg, HICON hIcon, DWORD dwICC);
5151 static BOOL bSetCheckDlgButton(HWND hDlg, int iIDButton, BOOL bCheck);
5252 static VOID vSetTrackbar(HWND hDlg, int iIDTrackbar, int iRangeMin, int iRangeMax, int iTickFreq, int iPos, int iPageSize);
5353 static BOOL bGetDlgButtonChecked(HWND hDlg, int iIDButton);
54-static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar);
54+static DWORD dwGetTrackbarPos(HWND hDlg, int iIDTrackbar);
5555
5656 //
5757 // bCreateTaskTrayWindow()
@@ -69,9 +69,6 @@ BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitle)
6969 nIco.dwInfoFlags = NIIF_USER | NIIF_LARGE_ICON | NIIF_NOSOUND;
7070 nIco.uVersion = NOTIFYICON_VERSION_4;
7171 nIco.hIcon = hIcon;
72- if ((nIco.hIcon = LoadIcon(Resource->hLoad(), MAKEINTRESOURCE(IDI_FLUSHMOUSE))) == NULL) {
73- return FALSE;
74- }
7572 _tcsncpy_s(nIco.szTip, ARRAYSIZE(nIco.szTip), lpszTitle, _TRUNCATE);
7673 try {
7774 throw Shell_NotifyIcon(NIM_ADD, &nIco);
@@ -231,7 +228,6 @@ void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
231228 Cime->vIMEOpenCloseForced(hWnd, IMECLOSE);
232229 }
233230 [[fallthrough]];
234- //break;
235231 case WM_RBUTTONDOWN:
236232 bDisplayIMEModeOnCursor = FALSE;
237233 bDoModeDispByMouseBttnUp = FALSE;
@@ -246,7 +242,7 @@ void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
246242 stAppBarData.cbSize = sizeof(APPBARDATA);
247243 stAppBarData.hWnd = hWnd;
248244 SHAppBarMessage(ABM_GETTASKBARPOS, &stAppBarData);
249- UINT uFlags = 0;
245+ UINT uFlags = 0;
250246 switch (stAppBarData.uEdge) {
251247 case ABE_TOP:
252248 uFlags = TPM_RIGHTALIGN | TPM_TOPALIGN;
@@ -268,6 +264,7 @@ void Cls_OnTaskTrayEx(HWND hWnd, UINT id, UINT uMsg)
268264 TrackPopupMenu(hSubMenu, uFlags, pt.x, pt.y, 0, hWnd, NULL);
269265 break;
270266 }
267+ return;
271268 }
272269
273270 //
@@ -296,7 +293,7 @@ static INT_PTR CALLBACK SettingDlg(HWND hDlg, UINT message, WPARAM wParam, LPARA
296293 bInitDlgCenter(hDlg, hIcon, (ICC_BAR_CLASSES | ICC_HOTKEY_CLASS));
297294 }
298295 {
299- TCHAR lpText[MAX_LOADSTRING];
296+ TCHAR lpText[MAX_LOADSTRING];
300297 if (LoadString(Resource->hLoad(), IDS_CMBX_LIST01, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
301298 SendDlgItemMessage(hDlg, IDC_COMBO1, CB_ADDSTRING, 0, (LPARAM)lpText);
302299 if (LoadString(Resource->hLoad(), IDS_CMBX_LIST02, lpText, MAX_LOADSTRING) == 0) return (INT_PTR)FALSE;
--- a/FlushMouseLIB/TaskTray.h
+++ b/FlushMouseLIB/TaskTray.h
@@ -4,8 +4,8 @@
44 //
55 // No. Date Name Reason & Document
66 // -------+-----------+-----------+-------------------------------------------- -
7-// #0000 2022/03/03 JeffyTS New edit.
8-// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.h
7+// #0000 2022/03/03 JeffyTS New edit.
8+// #0001 2023/06/30 JeffyTS Divided from FlushMouseSub.h
99
1010 //
1111 // Include
@@ -23,7 +23,7 @@ extern BOOL bIMEInConverting;
2323 //
2424 // Global Prototype Define
2525 //
26-extern BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitile);
26+extern BOOL bCreateTaskTrayWindow(HWND hWnd, HICON hIcon, LPCTSTR lpszTitile);
2727 extern BOOL bReCreateTaskTrayWindow(HWND hWnd, UINT message);
2828 extern BOOL bDestroyTaskTrayWindow(HWND hWnd);
2929 extern BOOL bGetTaskTrayWindowRect(HWND hWnd, LPRECT lpRect);
Binary files a/FlushMouse_x64.msi and b/FlushMouse_x64.msi differ
--- a/OSDN Wiki/osdn.txt
+++ b/OSDN Wiki/osdn.txt
@@ -2,7 +2,7 @@
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)'''||
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]]
88
--- a/README.md
+++ b/README.md
@@ -5,10 +5,11 @@
55
66 #### リリース情報
77
8-* **2023/08/06  Version 1.1.6.5 をリリースしました**
8+* **2023/08/24  Version 1.1.7.24 をリリースしました**
99
1010 * **(主な変更点)**
11- * TABキーやEnterキーでもIMEモードを表示するようにしました
11+ * マウスクリックでIMEモードを表示しないことがあるバグを修正しました
12+ * 漢字(半角 / 全角)キーを押したときの処理を見直しました
1213 * その他、軽微なバグを修正しました
1314
1415 * 最近(2023/07以降)、[OSDN/FlushMouse](https://osdn.net/users/jeffyts/pf/FlushMouse/wiki/FrontPage) が、不安定なようですので、 [GitHub/FlushMouse](https://github.com/JeffyTS-JP/FlushMouse)の方をチェックしていただいたほうが良いかもしれません(どちらにも同じソースとバイナリを置くようにします)
@@ -93,16 +94,17 @@
9394 * IME関連キーの動作は下記のようになります(IMEの設定でキーマップを変更している場合は異なることがあります)
9495 * FlushMouse 動作時 (ExplorerPatcher Simple Window Switcher HelperをONにした場合)
9596 * JA / IME の時は、英数、ひらがな、カタカナ(Shift + ひらがな)のみコントロールしています。その他は,Windowsのデフォルトの動作です (以前のバージョンの IMEを使用してキーマップを変更すると使いやすくなると思います)
97+ * JA / ENG の時、キーボードロケールを返さないアプリがあります。この場合は、前のIMEの状態に戻すことができません(これは制限事項となります)
9698
9799 |↓押下キー   IMEの状態→|  JA / IME   |  JA / ENG   |  US / ENG   |
98100 | :---: | :---: | :---: | :---: |
99101 |半角 / 全角 (漢字) |   あ / A   |(前のIME ON状態) |(前のIME ON状態) |
100-|無変換 |   IME OFF   |   IME OFF   |   IME OFF   |
102+|無変換 |   IME OFF   |    -    |   IME OFF   |
101103 |無変換(IME ONの状態から) | あ / ア / _ア  |(前のIME ON状態) |(前のIME ON状態) |
102104 |変換 |(前のIME ON状態) |(前のIME ON状態) |(前のIME ON状態) |
103105 |ひらがな |    あ    |(前のIME ON状態) |(前のIME ON状態) |
104106 |カタカナ (Shift + ひらがな)|    カ    |(前のIME ON状態) |(前のIME ON状態) |
105-|英数 |    A     |(前のIME ON状態) |(前のIME ON状態) |
107+|英数 |    A     |    -    |(前のIME ON状態) |
106108
107109 * Windowsのデフォルト(参考)
108110
@@ -146,7 +148,8 @@
146148 3. 次に、WiXを使用するために、Windowsの設定 -> アプリ -> オプション機能 -> Windowsのその他の機能 -> Windowsの機能の有効化または無効化 -> .NET Framework 3.5.1(.NET 2.0及び3.0を含む)にチェックを入れてOKを押して、インストール、再起動します
147149 4. [https://github.com/wixtoolset/wix3](https://github.com/wixtoolset/wix3) から、Wix311.exeをダウンロードしてインストールします
148150 5. Visual Studioを起動して 右下の「コードなし」で起動します
149- 6. 拡張機能 -> 検索で WiXと入力し「 WiX v3 - Visual Studio 2022 Extension」を選択して、Visual Studioを終了するとインストールが始まります
151+ 6. Tools -> Options -> Environment -> International Settings をクリックして、Languageを日本語にします
152+ 7. 拡張機能 -> 検索で WiXと入力し「 WiX v3 - Visual Studio 2022 Extension」を選択して、Visual Studioを終了するとインストールが始まります
150153
151154 * ビルド方法です
152155 1. Visual Studioを起動して、リポジトリのクローン -> リポジトリの場所に [https://github.com/JeffyTS-JP/FlushMouse.git](https://github.com/JeffyTS-JP/FlushMouse.git) を入力してクローンします
Binary files a/SetupProject/Register_TaskScheduler.xml and b/SetupProject/Register_TaskScheduler.xml differ
Binary files a/SetupProject/Register_TaskScheduler2.xml and b/SetupProject/Register_TaskScheduler2.xml differ
--- a/version.h
+++ b/version.h
@@ -9,11 +9,11 @@
99
1010 #define MAJOR_VERSION 1
1111 #define MINOR_VERSION 1
12-#define BUILD_VERSION 6
13-#define REVISION_VERSION 0
12+#define BUILD_VERSION 7
13+#define REVISION_VERSION 24
1414
15-#define FILE_VERSION_STRING VALUE "FileVersion", "1.1.6.0"
16-#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "1.1.6.0"
15+#define FILE_VERSION_STRING VALUE "FileVersion", "1.1.7.24"
16+#define PRODUCT_VERSION_STRING VALUE "ProductVersion", "1.1.7.24"
1717
1818 #define FILE_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISION_VERSION
1919 #define PRODUCT_VERSION MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, REVISION_VERSION
--- a/version.wxi
+++ b/version.wxi
@@ -1,7 +1,7 @@
11 <Include>
22 <!-- for wix Setup Project -->
33 <!-- Copyright (C) 2023 JeffyTS -->
4- <?define Version = "1.1.6.0" ?>
4+ <?define Version = "1.1.7.24" ?>
55
66 <?define ProductName = "FlushMouse" ?>
77 <?define Manufacturer = "JeffyTS" ?>