OSDN Git Service

Give main roles to 32bit version and simplify 64bit version.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Tue, 26 Apr 2011 00:33:31 +0000 (09:33 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Thu, 26 May 2011 23:44:02 +0000 (08:44 +0900)
Add 64bit versions of CXkeymacsApp and CMainFrame. xkeymacs64.exe
consists of these classes. xkeymacs.exe launches xkeymacs64.exe on
WOW64 and controls it through a named pipe.

xkeymacs.dll and xkeymacs64.dll share the properties through a
temporary file. xkeymacs64.exe enables the keyboard hook after it
reads the properties.

17 files changed:
xkeymacs/mainfrm.cpp
xkeymacs/mainfrm64.cpp [new file with mode: 0644]
xkeymacs/mainfrm64.h [new file with mode: 0644]
xkeymacs/profile.cpp
xkeymacs/resource.h
xkeymacs/xkeymacs-vc10x64.vcxproj
xkeymacs/xkeymacs-vc10x64.vcxproj.filters
xkeymacs/xkeymacs-vc10x86.vcxproj
xkeymacs/xkeymacs-vc10x86.vcxproj.filters
xkeymacs/xkeymacs.cpp
xkeymacs/xkeymacs.h
xkeymacs/xkeymacs.rc
xkeymacs/xkeymacs64.cpp [new file with mode: 0644]
xkeymacs/xkeymacs64.h [new file with mode: 0644]
xkeymacsdll/ipc.h
xkeymacsdll/xkeymacsdll.cpp
xkeymacsdll/xkeymacsdll.h

index 0373cff..29d7dc2 100644 (file)
@@ -206,6 +206,7 @@ int CMainFrame::OnCreate(const LPCREATESTRUCT lpCreateStruct)
                                                                  AfxGetApp()->GetProfileInt(CString(), CString(MAKEINTRESOURCE(IDS_REG_ENTRY_CHANGE_CURSOR)), 0));\r
 \r
        CXkeymacsDll::SetHooks();\r
+       CXkeymacsDll::EnableKeyboardHook();\r
        StartPollThread();\r
 \r
        return 0;\r
@@ -527,6 +528,7 @@ void CMainFrame::OnQuit()
 \r
        CXkeymacsDll::ReleaseHooks();\r
        TerminatePollThread();\r
+       static_cast<CXkeymacsApp *>(AfxGetApp())->SendIPCMessage(XKEYMACS_EXIT);\r
        DeleteAllShell_NotifyIcon();\r
 \r
        PostQuitMessage(0);\r
@@ -578,6 +580,9 @@ void CMainFrame::OnReset()
        CXkeymacsDll::SetHooks();\r
        TerminatePollThread();\r
        StartPollThread();\r
+       CXkeymacsApp *pApp = static_cast<CXkeymacsApp *>(AfxGetApp());\r
+       if (!pApp->SendIPCMessage(XKEYMACS_RESET))\r
+               pApp->Create64bitProcess(); // try to restart 64bit app\r
 }\r
 \r
 void CMainFrame::OnHelpFinder() \r
diff --git a/xkeymacs/mainfrm64.cpp b/xkeymacs/mainfrm64.cpp
new file mode 100644 (file)
index 0000000..b0e2654
--- /dev/null
@@ -0,0 +1,30 @@
+#include "stdafx.h"\r
+#include "mainfrm64.h"\r
+\r
+IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)\r
+\r
+CMainFrame::CMainFrame()\r
+{\r
+       // register window class\r
+       WNDCLASS        stWndClass;\r
+       CString szClassName(MAKEINTRESOURCE(AFX_IDS_APP_TITLE));\r
+\r
+       stWndClass.style                        = CS_BYTEALIGNWINDOW;\r
+       stWndClass.lpfnWndProc          = &AfxWndProc;\r
+       stWndClass.cbClsExtra           = 0;\r
+       stWndClass.cbWndExtra           = 0;\r
+       stWndClass.hInstance            = AfxGetInstanceHandle();\r
+       stWndClass.hIcon                        = NULL;\r
+       stWndClass.hCursor                      = NULL;\r
+       stWndClass.hbrBackground        = (HBRUSH)COLOR_BACKGROUND;\r
+       stWndClass.lpszMenuName         = NULL;\r
+       stWndClass.lpszClassName        = szClassName;\r
+\r
+       AfxRegisterClass(&stWndClass);\r
+\r
+       // make window\r
+       CRect   rect(0, 0, 100, 100);\r
+\r
+       Create(szClassName, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)), WS_OVERLAPPEDWINDOW | WS_MINIMIZE, rect);\r
+}\r
+\r
diff --git a/xkeymacs/mainfrm64.h b/xkeymacs/mainfrm64.h
new file mode 100644 (file)
index 0000000..e450333
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef AFX_MAINFRM64_H_INCLUDED\r
+#define AFX_MAINFRM64_H_INCLUDED\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+class CMainFrame: public CFrameWnd\r
+{\r
+public:\r
+       CMainFrame();\r
+protected:\r
+       DECLARE_DYNCREATE(CMainFrame)\r
+};\r
+\r
+#endif // AFX_MAINFRM64_H_INCLUDED\r
index 2f90506..2bebf78 100644 (file)
@@ -822,6 +822,12 @@ void CProfile::SetDllData()
                CXkeymacsDll::SetEnableCUA(nApplicationID, m_XkeymacsData[nApplicationID].GetEnableCUA());\r
                CXkeymacsDll::Set326Compatible(nApplicationID, m_XkeymacsData[nApplicationID].Get326Compatible());\r
        }\r
+       CXkeymacsApp *pApp = static_cast<CXkeymacsApp *>(AfxGetApp());\r
+       if (!pApp->IsWow64())\r
+               return;\r
+       if (!CXkeymacsDll::SaveConfig())\r
+               return;\r
+       pApp->SendIPCMessage(XKEYMACS_RELOAD);\r
 }\r
 \r
 void CProfile::ReadKeyBind(int *const pnCommandType, int *const pnKey, LPCTSTR szKeyBind)\r
index 1f85928..d07afc7 100644 (file)
@@ -31,7 +31,7 @@
 #define IDC_REG_ENTRY_IGNORE_META_CTRL  29\r
 #define IDC_REG_ENTRY_IGNORE_C_X        30\r
 #define IDS_ERR_SAVE_DATA               31\r
-#define IDS_ERR_WINDOWS_VERSION         32\r
+#define IDS_ERR_32BIT                   32\r
 #define IDS_ERR_IMPORT                  33\r
 #define IDS_ERR_EXPORT                  34\r
 #define IDC_REG_ENTRY_ENABLE_CUA        35\r
index bf8a145..b640155 100644 (file)
     </ResourceCompile>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="104keyboard.cpp" />\r
-    <ClCompile Include="109keyboard.cpp" />\r
-    <ClCompile Include="about.cpp" />\r
-    <ClCompile Include="data.cpp" />\r
-    <ClCompile Include="dotxkeymacs.cpp" />\r
-    <ClCompile Include="key.cpp" />\r
-    <ClCompile Include="keyboardlayout.cpp" />\r
-    <ClCompile Include="mainfrm.cpp" />\r
-    <ClCompile Include="optionsdlg.cpp" />\r
-    <ClCompile Include="profile.cpp" />\r
-    <ClCompile Include="properties.cpp" />\r
-    <ClCompile Include="propertiesadvanced.cpp" />\r
-    <ClCompile Include="propertiesbasic.cpp" />\r
-    <ClCompile Include="propertieslist.cpp" />\r
-    <ClCompile Include="stdafx.cpp" />\r
-    <ClCompile Include="xkeymacs.cpp" />\r
+    <ClCompile Include="104keyboard.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="109keyboard.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="about.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="data.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="dotxkeymacs.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="key.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="keyboardlayout.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="mainfrm.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="mainfrm64.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="optionsdlg.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="profile.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="properties.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertiesadvanced.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertiesbasic.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertieslist.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="stdafx.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="xkeymacs.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="xkeymacs64.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="104keyboard.h" />\r
     <ClInclude Include="key.h" />\r
     <ClInclude Include="keyboardlayout.h" />\r
     <ClInclude Include="mainfrm.h" />\r
+    <ClInclude Include="mainfrm64.h" />\r
     <ClInclude Include="optionsdlg.h" />\r
     <ClInclude Include="profile.h" />\r
     <ClInclude Include="properties.h" />\r
     <ClInclude Include="resource.h" />\r
     <ClInclude Include="stdafx.h" />\r
     <ClInclude Include="xkeymacs.h" />\r
+    <ClInclude Include="xkeymacs64.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="xkeymacs.rc" />\r
index c069067..be98f33 100644 (file)
     <ClCompile Include="data.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="mainfrm64.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
     <ClCompile Include="about.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="xkeymacs64.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="104keyboard.h">\r
     <ClInclude Include="data.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="mainfrm64.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
     <ClInclude Include="about.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="xkeymacs64.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="xkeymacs.rc">\r
index bf8a145..b640155 100644 (file)
     </ResourceCompile>\r
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="104keyboard.cpp" />\r
-    <ClCompile Include="109keyboard.cpp" />\r
-    <ClCompile Include="about.cpp" />\r
-    <ClCompile Include="data.cpp" />\r
-    <ClCompile Include="dotxkeymacs.cpp" />\r
-    <ClCompile Include="key.cpp" />\r
-    <ClCompile Include="keyboardlayout.cpp" />\r
-    <ClCompile Include="mainfrm.cpp" />\r
-    <ClCompile Include="optionsdlg.cpp" />\r
-    <ClCompile Include="profile.cpp" />\r
-    <ClCompile Include="properties.cpp" />\r
-    <ClCompile Include="propertiesadvanced.cpp" />\r
-    <ClCompile Include="propertiesbasic.cpp" />\r
-    <ClCompile Include="propertieslist.cpp" />\r
-    <ClCompile Include="stdafx.cpp" />\r
-    <ClCompile Include="xkeymacs.cpp" />\r
+    <ClCompile Include="104keyboard.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="109keyboard.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="about.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="data.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="dotxkeymacs.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="key.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="keyboardlayout.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="mainfrm.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="mainfrm64.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="optionsdlg.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="profile.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="properties.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertiesadvanced.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertiesbasic.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="propertieslist.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="stdafx.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="xkeymacs.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
+    <ClCompile Include="xkeymacs64.cpp">\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>\r
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="104keyboard.h" />\r
     <ClInclude Include="key.h" />\r
     <ClInclude Include="keyboardlayout.h" />\r
     <ClInclude Include="mainfrm.h" />\r
+    <ClInclude Include="mainfrm64.h" />\r
     <ClInclude Include="optionsdlg.h" />\r
     <ClInclude Include="profile.h" />\r
     <ClInclude Include="properties.h" />\r
     <ClInclude Include="resource.h" />\r
     <ClInclude Include="stdafx.h" />\r
     <ClInclude Include="xkeymacs.h" />\r
+    <ClInclude Include="xkeymacs64.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="xkeymacs.rc" />\r
index c069067..be98f33 100644 (file)
     <ClCompile Include="data.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="mainfrm64.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
     <ClCompile Include="about.cpp">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="xkeymacs64.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="104keyboard.h">\r
     <ClInclude Include="data.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="mainfrm64.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
     <ClInclude Include="about.h">\r
       <Filter>Header Files</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="xkeymacs64.h">\r
+      <Filter>Header Files</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ResourceCompile Include="xkeymacs.rc">\r
index 47d9eb2..f4c04bd 100644 (file)
@@ -28,6 +28,7 @@ END_MESSAGE_MAP()
 CXkeymacsApp::CXkeymacsApp()\r
 {\r
        m_hMutex = NULL;\r
+       m_bIsWow64 = FALSE;\r
 }\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
@@ -46,16 +47,12 @@ BOOL CXkeymacsApp::InitInstance()
        // If you are not using these features and wish to reduce the size\r
        //  of your final executable, you should remove from the following\r
        //  the specific initialization routines you do not need.\r
-#ifdef _WIN64\r
-       m_hMutex = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)) + _T("64"));\r
-#else\r
        m_hMutex = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)));\r
-#endif\r
-    if (GetLastError() == ERROR_ALREADY_EXISTS) {\r
-        CloseHandle(m_hMutex);\r
+       if (GetLastError() == ERROR_ALREADY_EXISTS) {\r
+               CloseHandle(m_hMutex);\r
                m_hMutex = NULL;\r
-        return FALSE;\r
-    }\r
+               return FALSE;\r
+       }\r
 \r
 #ifdef _AFXDLL\r
        Enable3dControls();                     // Call this when using MFC in a shared DLL\r
@@ -83,12 +80,60 @@ BOOL CXkeymacsApp::InitInstance()
        SetClassLongPtr(m_pMainWnd->m_hWnd, GCLP_HICON, (LONG_PTR)LoadIcon(IDR_MAINFRAME));\r
 \r
        // set registry key\r
-       CProfile::InitDllData();\r
        CUtils::InitCUtils();\r
+       if (!Create64bitProcess())\r
+               return FALSE;\r
+       CProfile::InitDllData();\r
+\r
+       return TRUE;\r
+}\r
+\r
+BOOL CXkeymacsApp::IsWow64()\r
+{\r
+       return m_bIsWow64;\r
+}\r
 \r
+BOOL CXkeymacsApp::Create64bitProcess()\r
+{\r
+       typedef BOOL (WINAPI *PFIsWow64Process)(HANDLE, PBOOL);\r
+       PFIsWow64Process func = (PFIsWow64Process)GetProcAddress(GetModuleHandle(_T("kernel32")), _T("IsWow64Process"));\r
+       if (!func)\r
+               return TRUE; // IsWow64Process not exists\r
+       if (!func(GetCurrentProcess(), &m_bIsWow64))\r
+               return FALSE; // error\r
+       if (!m_bIsWow64)\r
+               return TRUE; // do nothing\r
+       \r
+       TCHAR szFileName[MAX_PATH];\r
+       if (!GetModuleFileName(NULL, szFileName, sizeof(szFileName)))\r
+               return FALSE;\r
+       TCHAR szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFile[_MAX_FNAME], szExt[_MAX_EXT];\r
+       if (_tsplitpath_s(szFileName, szDrive, szDir, szFile, szExt) ||\r
+                       _tcscat_s(szFile, _T("64")) ||\r
+                       _tmakepath_s(szFileName, szDrive, szDir, szFile, szExt))\r
+               return FALSE;\r
+\r
+       STARTUPINFO si;\r
+       ZeroMemory(&si, sizeof(si));\r
+       si.cb = sizeof(si);\r
+       PROCESS_INFORMATION pi;\r
+       ZeroMemory(&pi, sizeof(pi));\r
+       if (!CreateProcess(szFileName, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))\r
+               return FALSE;\r
+       // close unused handles\r
+       CloseHandle(pi.hProcess);\r
+       CloseHandle(pi.hThread);\r
        return TRUE;\r
 }\r
 \r
+BOOL CXkeymacsApp::SendIPCMessage(DWORD msg)\r
+{\r
+       if (!m_bIsWow64)\r
+               return TRUE;\r
+       DWORD ack, read;\r
+       return CallNamedPipe(IPC_PIPE, &msg, sizeof(msg), &ack, sizeof(DWORD), &read, 10000);\r
+}\r
+\r
 int CXkeymacsApp::ExitInstance() \r
 {\r
        if (m_hMutex) {\r
index d751cfb..fa9433d 100644 (file)
@@ -37,9 +37,13 @@ public:
                // NOTE - the ClassWizard will add and remove member functions here.\r
                //    DO NOT EDIT what you see in these blocks of generated code !\r
        //}}AFX_MSG\r
+       BOOL IsWow64();\r
+       BOOL SendIPCMessage(DWORD msg);\r
+       BOOL Create64bitProcess();\r
        DECLARE_MESSAGE_MAP()\r
 private:\r
        HANDLE m_hMutex;\r
+       BOOL m_bIsWow64;\r
 };\r
 \r
 //{{AFX_INSERT_LOCATION}}\r
index cbc21f4..646687f 100644 (file)
@@ -1056,7 +1056,7 @@ END
 \r
 STRINGTABLE DISCARDABLE \r
 BEGIN\r
-    IDS_ERR_WINDOWS_VERSION "XKeymacs \82Í\82±\82Ì\83o\81[\83W\83\87\83\93\82Ì Windows \82ð\83T\83|\81[\83g\82µ\82Ä\82¨\82è\82Ü\82¹\82ñ\81B"\r
+    IDS_ERR_32BIT           "32\83r\83b\83g\94Å\82Ì xkeymacs.exe \82ð\8eÀ\8ds\82µ\82Ä\82­\82¾\82³\82¢\81B"\r
     IDS_ERR_IMPORT          "%s\n\83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81B\n\8ew\92è\82µ\82½\83t\83@\83C\83\8b\96¼\82ª\90³\82µ\82¢\82©\82Ç\82¤\82©\8am\94F\82µ\82Ä\82­\82¾\82³\82¢\81B"\r
     IDS_ERR_EXPORT          "\90Ý\92è\82Ì\8f\91\82«\8fo\82µ\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B"\r
     IDC_REG_ENTRY_ENABLE_CUA "Enable CUA"\r
@@ -2874,7 +2874,7 @@ END
 \r
 STRINGTABLE DISCARDABLE \r
 BEGIN\r
-    IDS_ERR_WINDOWS_VERSION "XKeymacs does not support the Windows of this version."\r
+    IDS_ERR_32BIT           "Please start 32bit version of xkeymacs.exe."\r
     IDS_ERR_IMPORT          "%s\nFile not found.\nPlease verify the correct file name was given."\r
     IDS_ERR_EXPORT          "Failed to export properties."\r
     IDC_REG_ENTRY_ENABLE_CUA "Enable CUA"\r
diff --git a/xkeymacs/xkeymacs64.cpp b/xkeymacs/xkeymacs64.cpp
new file mode 100644 (file)
index 0000000..7e15352
--- /dev/null
@@ -0,0 +1,90 @@
+#include "stdafx.h"\r
+#include "xkeymacs64.h"\r
+#include "mainfrm64.h"\r
+\r
+CXkeymacsApp::CXkeymacsApp()\r
+{\r
+       m_hMutex = NULL;\r
+}\r
+\r
+CXkeymacsApp theApp;\r
+\r
+static UINT PollIPCMessage(LPVOID lpParam);\r
+\r
+BOOL CXkeymacsApp::InitInstance()\r
+{\r
+       HANDLE h32 = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)));\r
+       if (GetLastError() != ERROR_ALREADY_EXISTS) {\r
+               AfxMessageBox(CString(MAKEINTRESOURCE(IDS_ERR_32BIT)));\r
+               CloseHandle(h32);\r
+               return FALSE;\r
+       }\r
+       CloseHandle(h32);\r
+       m_hMutex = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE)) + _T("64"));\r
+    if (GetLastError() == ERROR_ALREADY_EXISTS) {\r
+        CloseHandle(m_hMutex);\r
+               m_hMutex = NULL;\r
+        return FALSE;\r
+    }\r
+\r
+       m_pMainWnd = new CMainFrame;\r
+       m_pMainWnd->ShowWindow(SW_HIDE);\r
+       m_pMainWnd->UpdateWindow();\r
+       SetClassLongPtr(m_pMainWnd->m_hWnd, GCLP_HICON, (LONG_PTR)LoadIcon(IDR_MAINFRAME));\r
+\r
+       CUtils::InitCUtils();\r
+       AfxBeginThread(PollIPCMessage, NULL);\r
+       CXkeymacsDll::SetHooks();\r
+       return TRUE;\r
+}\r
+\r
+UINT PollIPCMessage(LPVOID lpParam)\r
+{\r
+       HANDLE hPipe = CreateNamedPipe(IPC_PIPE, PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 1, 512, 512, 0, NULL);\r
+       if (hPipe == INVALID_HANDLE_VALUE)\r
+               return 1;\r
+       for (; ;) {\r
+               if (ConnectNamedPipe(hPipe, NULL) ? FALSE : (GetLastError() != ERROR_PIPE_CONNECTED))\r
+                       break;\r
+               DWORD msg;\r
+               DWORD read;\r
+               if (!ReadFile(hPipe, &msg, sizeof(msg), &read, NULL) || read != sizeof(msg)) \r
+                       break;\r
+               DWORD written, nul = 0;\r
+               if (!WriteFile(hPipe, &nul, sizeof(DWORD), &written, NULL) || written != sizeof(DWORD)\r
+                               || !FlushFileBuffers(hPipe) || !DisconnectNamedPipe(hPipe))\r
+                       break;\r
+               switch (msg)\r
+               {\r
+               case XKEYMACS_EXIT:\r
+                       goto exit;\r
+                       break;\r
+               case XKEYMACS_RELOAD:\r
+                       if (CXkeymacsDll::LoadConfig())\r
+                               CXkeymacsDll::EnableKeyboardHook();\r
+                       break;\r
+               case XKEYMACS_RESET:\r
+                       CXkeymacsDll::ReleaseHooks();\r
+                       CXkeymacsDll::SetHooks();\r
+                       break;\r
+               }\r
+       }\r
+exit:\r
+       CloseHandle(hPipe);\r
+       CXkeymacsDll::ReleaseHooks();\r
+       ExitProcess(0);\r
+       return 0;\r
+}\r
+\r
+int CXkeymacsApp::ExitInstance() \r
+{\r
+       if (m_hMutex) {\r
+               CloseHandle(m_hMutex);\r
+\r
+               m_pMainWnd->DestroyWindow();\r
+               delete m_pMainWnd;\r
+               m_pMainWnd = NULL;\r
+       }\r
+\r
+       return CWinApp::ExitInstance();\r
+}\r
diff --git a/xkeymacs/xkeymacs64.h b/xkeymacs/xkeymacs64.h
new file mode 100644 (file)
index 0000000..d366608
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef AFX_XKEYMACS64_H_INCLUDED\r
+#define AFX_XKEYMACS64_H_INCLUDED\r
+\r
+#if _MSC_VER > 1000\r
+#pragma once\r
+#endif // _MSC_VER > 1000\r
+\r
+#include "resource.h"\r
+\r
+class CXkeymacsApp : public CWinApp\r
+{\r
+public:\r
+       CXkeymacsApp();\r
+// Overrides\r
+       // ClassWizard generated virtual function overrides\r
+       //{{AFX_VIRTUAL(CXkeymacsApp)\r
+       public:\r
+       virtual BOOL InitInstance();\r
+       virtual int ExitInstance();\r
+       //}}AFX_VIRTUAL\r
+private:\r
+       HANDLE m_hMutex;\r
+};\r
+\r
+#endif // AFX_XKEYMACS64_H_INCLUDED\r
index 713fe29..1c0624c 100644 (file)
@@ -11,5 +11,26 @@ struct ICONMSG {
        TCHAR szTip[128];\r
 };\r
 \r
+struct CONFIG {\r
+       int nMessage;\r
+       BOOL b326Compatible[MAX_APP];\r
+       TCHAR szWindowText[MAX_APP][WINDOW_TEXT_LENGTH];\r
+       TCHAR szFunctionDefinition[MAX_FUNCTION][MAX_DEFINITION];\r
+       int nFunctionID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
+       BOOL bEnableCUA[MAX_APP];\r
+       BOOL bUseDialogSetting[MAX_APP];\r
+       BOOL bIgnoreUndefinedC_x[MAX_APP];\r
+       BOOL bIgnoreUndefinedMetaCtrl[MAX_APP];\r
+       int nSettingStyle[MAX_APP];\r
+       int nKillRingMax[MAX_APP];\r
+       TCHAR szSpecialApp[MAX_APP][CLASS_NAME_LENGTH];\r
+       int nCommandID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
+       BOOL bAtIbeamCursorOnly[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
+       BOOL b106Keyboard;\r
+};\r
+\r
+enum XKEYMACS_IPC { XKEYMACS_EXIT, XKEYMACS_RELOAD, XKEYMACS_RESET };\r
+\r
 #define ICON_PIPE _T("\\\\.\\pipe\\XKEYMACS_ICON")\r
+#define IPC_PIPE _T("\\\\.\\pipe\\XKEYMACS_IPC")\r
 #endif\r
index 4969958..9a11ddc 100644 (file)
@@ -201,39 +201,23 @@ DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
        HHOOK   CXkeymacsDll::m_hHookCallWndRet = NULL;\r
        HHOOK   CXkeymacsDll::m_hHookGetMessage = NULL;\r
        HHOOK   CXkeymacsDll::m_hHookShell = NULL;\r
-       int             CXkeymacsDll::m_nCommandID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_bAtIbeamCursorOnly[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
-       int             CXkeymacsDll::m_nFunctionID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
-       TCHAR   CXkeymacsDll::m_szSpecialApp[MAX_APP][CLASS_NAME_LENGTH] = {'\0'};\r
-       TCHAR   CXkeymacsDll::m_szWindowText[MAX_APP][WINDOW_TEXT_LENGTH] = {'\0'};\r
        BOOL    CXkeymacsDll::m_bRightControl   = FALSE;\r
        BOOL    CXkeymacsDll::m_bRightAlt               = FALSE;\r
        BOOL    CXkeymacsDll::m_bRightShift             = FALSE;\r
        BOOL    CXkeymacsDll::m_bHook                   = TRUE;\r
        BOOL    CXkeymacsDll::m_bDefiningMacro  = FALSE;\r
-       int             CXkeymacsDll::m_nKillRingMax[MAX_APP] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_bUseDialogSetting[MAX_APP] = {'\0'};\r
        CList<CClipboardSnap *, CClipboardSnap *> CXkeymacsDll::m_oKillRing;\r
        CObList CXkeymacsDll::m_Macro;\r
        int             CXkeymacsDll::m_nKillRing = 0;\r
        int             CXkeymacsDll::m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
        int             CXkeymacsDll::m_nApplicationID = 0;\r
-       int             CXkeymacsDll::m_nSettingStyle[MAX_APP] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_bIgnoreUndefinedMetaCtrl[MAX_APP] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_bIgnoreUndefinedC_x[MAX_APP] = {'\0'};\r
-//     int             CXkeymacsDll::m_nPassThrough = 0;\r
-       TCHAR   CXkeymacsDll::m_szApplicationName[MAX_PATH] = {'\0'};\r
-       TCHAR   CXkeymacsDll::m_szOldApplicationName[MAX_PATH] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_bEnableCUA[MAX_APP] = {'\0'};\r
-       TCHAR   CXkeymacsDll::m_szFunctionDefinition[MAX_FUNCTION][MAX_DEFINITION] = {'\0'};\r
        int             CXkeymacsDll::m_nAccelerate = 0;\r
        int             CXkeymacsDll::m_nKeyboardSpeed = 31;\r
        HCURSOR CXkeymacsDll::m_hCursor[MAX_STATUS] = {'\0'};\r
        HCURSOR CXkeymacsDll::m_hCurrentCursor = NULL;\r
        BOOL    CXkeymacsDll::m_bCursor = FALSE;\r
-       BOOL    CXkeymacsDll::m_b326Compatible[MAX_APP] = {'\0'};\r
-       BOOL    CXkeymacsDll::m_b106Keyboard = FALSE;\r
        TCHAR   CXkeymacsDll::m_M_xTip[128] = "";\r
+       CONFIG  CXkeymacsDll::m_Config = {0};\r
 #pragma data_seg()\r
 \r
 //////////////////////////////////////////////////////////////////////\r
@@ -250,16 +234,52 @@ CXkeymacsDll::~CXkeymacsDll()
 \r
 }\r
 \r
+BOOL CXkeymacsDll::SaveConfig()\r
+{\r
+       TCHAR szTmp[MAX_PATH];\r
+       if (!GetTempPath(MAX_PATH, szTmp))\r
+               return FALSE;\r
+       if (_tmakepath_s(szTmp, NULL, szTmp, _T("xkeymacs"), _T("tmp")))\r
+               return FALSE;\r
+       HANDLE hFile = CreateFile(szTmp, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);\r
+       if (hFile == INVALID_HANDLE_VALUE)\r
+               return FALSE;\r
+       DWORD written;\r
+       BOOL res = WriteFile(hFile, &m_Config, sizeof(m_Config), &written, NULL) || written != sizeof(m_Config);\r
+       CloseHandle(hFile);\r
+       return res;\r
+}\r
+\r
+BOOL CXkeymacsDll::LoadConfig()\r
+{\r
+       TCHAR szTmp[MAX_PATH];\r
+       if (!GetTempPath(MAX_PATH, szTmp))\r
+               return FALSE;\r
+       if (_tmakepath_s(szTmp, NULL, szTmp, _T("xkeymacs"), _T("tmp")))\r
+               return FALSE;\r
+       HANDLE hFile = CreateFile(szTmp, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);\r
+       if (hFile == INVALID_HANDLE_VALUE)\r
+               return FALSE;\r
+       DWORD read;\r
+       BOOL res = ReadFile(hFile, &m_Config, sizeof(m_Config), &read, NULL) && read == sizeof(m_Config);\r
+       CloseHandle(hFile);\r
+       return res;\r
+}\r
+\r
 // set hooks\r
 void CXkeymacsDll::SetHooks()\r
 {\r
-       m_bEnableKeyboardHook = TRUE;\r
        m_hHookCallWnd = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)CallWndProc, g_hDllInst, 0);\r
        m_hHookCallWndRet = SetWindowsHookEx(WH_CALLWNDPROCRET, (HOOKPROC)CallWndRetProc, g_hDllInst, 0);\r
        m_hHookGetMessage = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)GetMsgProc, g_hDllInst, 0);\r
        m_hHookShell = SetWindowsHookEx(WH_SHELL, (HOOKPROC)ShellProc, g_hDllInst, 0);\r
 }\r
 \r
+void CXkeymacsDll::EnableKeyboardHook()\r
+{\r
+       m_bEnableKeyboardHook = TRUE;\r
+}\r
+\r
 void CXkeymacsDll::SetKeyboardHook()\r
 {\r
        if (!g_hHookKeyboard)\r
@@ -306,8 +326,8 @@ void CXkeymacsDll::SetKeyboardHookFlag(BOOL bFlag)
        } else {\r
                msg.nState = STATUS_DISABLE_WOCQ;\r
        }\r
-       if (m_nSettingStyle[m_nApplicationID] == SETTING_DISABLE\r
-        || (!_tcsicmp(m_szSpecialApp[m_nApplicationID], _T("Default"))\r
+       if (m_Config.nSettingStyle[m_nApplicationID] == SETTING_DISABLE\r
+        || (!_tcsicmp(m_Config.szSpecialApp[m_nApplicationID], _T("Default"))\r
          && CUtils::IsDefaultIgnoreApplication())) {\r
                msg.nState = STATUS_DISABLE;\r
                m_hCurrentCursor = m_hCursor[STATUS_DISABLE];\r
@@ -665,16 +685,16 @@ void CXkeymacsDll::InitKeyboardProc(BOOL bImeComposition)
 \r
        CUtils::SetApplicationName(bImeComposition);\r
 \r
-       if (_tcsnicmp(m_szSpecialApp[m_nApplicationID], CUtils::GetApplicationName(), 0xF) || !IsMatchWindowText(m_szWindowText[m_nApplicationID])) {   // PROCESSENTRY32 has only 0xF bytes of Name\r
+       if (_tcsnicmp(m_Config.szSpecialApp[m_nApplicationID], CUtils::GetApplicationName(), 0xF) || !IsMatchWindowText(m_Config.szWindowText[m_nApplicationID])) {     // PROCESSENTRY32 has only 0xF bytes of Name\r
                m_nApplicationID = -1;\r
 \r
                for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
-                       if (!_tcsnicmp(m_szSpecialApp[nApplicationID], CUtils::GetApplicationName(), 0xF) && IsMatchWindowText(m_szWindowText[nApplicationID])) {\r
+                       if (!_tcsnicmp(m_Config.szSpecialApp[nApplicationID], CUtils::GetApplicationName(), 0xF) && IsMatchWindowText(m_Config.szWindowText[nApplicationID])) {\r
 \r
                                if (m_nApplicationID < 0\r
-                                || CUtils::GetWindowTextType(m_szWindowText[m_nApplicationID]) < CUtils::GetWindowTextType(m_szWindowText[nApplicationID])\r
-                                || CUtils::GetWindowTextType(m_szWindowText[m_nApplicationID]) == CUtils::GetWindowTextType(m_szWindowText[nApplicationID])\r
-                                && _tcscmp(m_szWindowText[m_nApplicationID], m_szWindowText[nApplicationID]) <= 0) {\r
+                                || CUtils::GetWindowTextType(m_Config.szWindowText[m_nApplicationID]) < CUtils::GetWindowTextType(m_Config.szWindowText[nApplicationID])\r
+                                || CUtils::GetWindowTextType(m_Config.szWindowText[m_nApplicationID]) == CUtils::GetWindowTextType(m_Config.szWindowText[nApplicationID])\r
+                                && _tcscmp(m_Config.szWindowText[m_nApplicationID], m_Config.szWindowText[nApplicationID]) <= 0) {\r
                                        m_nApplicationID = nApplicationID;\r
                                }\r
                        }\r
@@ -682,7 +702,7 @@ void CXkeymacsDll::InitKeyboardProc(BOOL bImeComposition)
 \r
                if (m_nApplicationID < 0) {\r
                        for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) {\r
-                               if (!_tcsicmp(m_szSpecialApp[nApplicationID], _T("Default"))) {\r
+                               if (!_tcsicmp(m_Config.szSpecialApp[nApplicationID], _T("Default"))) {\r
                                        m_nApplicationID = nApplicationID;\r
                                        break;\r
                                }\r
@@ -694,15 +714,15 @@ void CXkeymacsDll::InitKeyboardProc(BOOL bImeComposition)
                }\r
        }\r
 \r
-       if (m_nSettingStyle[m_nApplicationID] != SETTING_DISABLE\r
-        && (_tcsicmp(m_szSpecialApp[m_nApplicationID], _T("Default")) || !CUtils::IsDefaultIgnoreApplication())\r
+       if (m_Config.nSettingStyle[m_nApplicationID] != SETTING_DISABLE\r
+        && (_tcsicmp(m_Config.szSpecialApp[m_nApplicationID], _T("Default")) || !CUtils::IsDefaultIgnoreApplication())\r
         && !bImeComposition\r
         && CUtils::IsDialog()) {\r
                // Use Dialog Setting\r
-               if (m_bUseDialogSetting[m_nApplicationID]) {\r
+               if (m_Config.bUseDialogSetting[m_nApplicationID]) {\r
                        int nOriginalApplicationID = m_nApplicationID;\r
                        for (m_nApplicationID = 0; m_nApplicationID < MAX_APP; ++m_nApplicationID) {\r
-                               if (!_tcsicmp(m_szSpecialApp[m_nApplicationID], _T("Dialog"))) {\r
+                               if (!_tcsicmp(m_Config.szSpecialApp[m_nApplicationID], _T("Dialog"))) {\r
                                        break;\r
                                }\r
                        }\r
@@ -803,8 +823,8 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                 || nKey == VK_LMENU\r
                 || nKey == VK_RMENU) {\r
                        for (int i = 0; i < MAX_COMMAND_TYPE; ++i) {\r
-                               if (Commands[m_nCommandID[m_nApplicationID][i][nKey]].fCommand\r
-                                && (Commands[m_nCommandID[m_nApplicationID][i][nKey]].fCommand != CCommands::MetaAlt\r
+                               if (Commands[m_Config.nCommandID[m_nApplicationID][i][nKey]].fCommand\r
+                                && (Commands[m_Config.nCommandID[m_nApplicationID][i][nKey]].fCommand != CCommands::MetaAlt\r
                                  || nKey != VK_MENU && nKey != VK_LMENU && nKey != VK_RMENU)) {\r
                                        goto HOOK;\r
                                }\r
@@ -824,12 +844,12 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                goto DO_NOTHING;\r
        }\r
 \r
-       if (m_nSettingStyle[m_nApplicationID] == SETTING_DISABLE) {\r
+       if (m_Config.nSettingStyle[m_nApplicationID] == SETTING_DISABLE) {\r
                goto DO_NOTHING;\r
        }\r
 \r
        // Do Nothing for Meadow, Mule for Win32, ... if those use default setting.\r
-       if (!_tcsicmp(m_szSpecialApp[m_nApplicationID], _T("Default"))\r
+       if (!_tcsicmp(m_Config.szSpecialApp[m_nApplicationID], _T("Default"))\r
         && CUtils::IsDefaultIgnoreApplication()) {\r
                goto DO_NOTHING;\r
        }\r
@@ -864,9 +884,9 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
 \r
                // Ignore undefined C-x ?\r
                if (nCommandType & CONTROLX) {\r
-                       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
-                        && m_nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
-                               if (m_bIgnoreUndefinedC_x[m_nApplicationID]) {\r
+                       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
+                        && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
+                               if (m_Config.bIgnoreUndefinedC_x[m_nApplicationID]) {\r
                                        CCommands::Reset(GOTO_HOOK);\r
                                        goto HOOK;\r
                                }\r
@@ -876,9 +896,9 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
 \r
                // Ignore undefined Meta Ctrl+?\r
                if (CCommands::bM_() && (nCommandType & CONTROL)) {\r
-                       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
-                        && m_nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
-                               if (m_bIgnoreUndefinedMetaCtrl[m_nApplicationID]) {\r
+                       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == NULL\r
+                        && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < 0) {\r
+                               if (m_Config.bIgnoreUndefinedMetaCtrl[m_nApplicationID]) {\r
                                        if (Original(CONTROL, nKey)) {\r
                                                Original(CONTROL, nKey, -1);\r
                                                goto DO_NOTHING;\r
@@ -910,17 +930,17 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                }\r
        }\r
 \r
-       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableOrDisableXKeymacs) {\r
+       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableOrDisableXKeymacs) {\r
                SetKeyboardHookFlag(!m_bHook);\r
                goto HOOK;\r
        }\r
-       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableXKeymacs) {\r
+       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EnableXKeymacs) {\r
                if (!m_bHook) {\r
                        SetKeyboardHookFlag(!m_bHook);\r
                }\r
                goto HOOK;\r
        }\r
-       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DisableXKeymacs) {\r
+       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DisableXKeymacs) {\r
                if (m_bHook) {\r
                        SetKeyboardHookFlag(!m_bHook);\r
                }\r
@@ -936,42 +956,42 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
 \r
                if (lParam & BEING_RELEASED) {\r
                        // ignore\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BackwardChar) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BackwardChar) {\r
                        if (index) {\r
                                --index;\r
                        }\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BeginningOfLine) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::BeginningOfLine) {\r
                        index = 0;\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteBackwardChar) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteBackwardChar) {\r
                        if (index) {\r
                                --index;\r
                                memmove(&szPath[index], &szPath[index + 1], _tcslen(szPath) - index);\r
                                SetM_xTip(szPath);\r
                        }\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteChar) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::DeleteChar) {\r
                        if (index < _tcslen(szPath)) {\r
                                memmove(&szPath[index], &szPath[index + 1], _tcslen(szPath) - index);\r
                                SetM_xTip(szPath);\r
                        }\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EndOfLine) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::EndOfLine) {\r
                        index = _tcslen(szPath);\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::ForwardChar) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::ForwardChar) {\r
                        if (index < _tcslen(szPath)) {\r
                                ++index;\r
                        }\r
                        goto HOOKX;\r
-               } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::KeyboardQuit) {\r
+               } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::KeyboardQuit) {\r
                        CCommands::bM_x(FALSE);\r
                        index = 0;\r
                        memset(szPath, 0, sizeof(szPath));\r
                        goto HOOK;\r
                } else if (nKey == VK_RETURN\r
-                               || Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::Newline) {\r
+                               || Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::Newline) {\r
                        InvokeM_x(szPath);\r
 \r
                        CCommands::bM_x(FALSE);\r
@@ -1006,47 +1026,47 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                }\r
        }\r
 \r
-       if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrl) {\r
+       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrl) {\r
                nOneShotModifier[nKey] = VK_LCONTROL;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
                nOneShotModifier[nKey] = VK_LCONTROL;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~CONTROL][nKey]].fCommand == CCommands::OneShotModifierCtrlRepeat) {\r
                ReleaseKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = FALSE;\r
                Kdu(nKey);\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAlt) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAlt) {\r
                nOneShotModifier[nKey] = VK_LMENU;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
                nOneShotModifier[nKey] = VK_LMENU;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~META][nKey]].fCommand == CCommands::OneShotModifierAltRepeat) {\r
                ReleaseKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = FALSE;\r
                Kdu(nKey);\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShift) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShift) {\r
                nOneShotModifier[nKey] = VK_SHIFT;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
                nOneShotModifier[nKey] = VK_SHIFT;\r
                DepressKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = TRUE;\r
                goto HOOK;\r
-       } else if (Commands[m_nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
+       } else if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType & ~SHIFT][nKey]].fCommand == CCommands::OneShotModifierShiftRepeat) {\r
                ReleaseKey(nOneShotModifier[nKey]);\r
                bCherryOneShotModifier = FALSE;\r
                Kdu(nKey);\r
@@ -1062,15 +1082,15 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                }\r
        }\r
 \r
-       if (0 <= m_nFunctionID[m_nApplicationID][nCommandType][nKey]\r
-        && m_nFunctionID[m_nApplicationID][nCommandType][nKey] < MAX_FUNCTION\r
-        && _tcslen(m_szFunctionDefinition[m_nFunctionID[m_nApplicationID][nCommandType][nKey]])) {\r
-               CallFunction(m_nFunctionID[m_nApplicationID][nCommandType][nKey]);\r
+       if (0 <= m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]\r
+        && m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey] < MAX_FUNCTION\r
+        && _tcslen(m_Config.szFunctionDefinition[m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]])) {\r
+               CallFunction(m_Config.nFunctionID[m_nApplicationID][nCommandType][nKey]);\r
                CCommands::Reset(GOTO_HOOK);\r
                goto HOOK;\r
        }\r
 \r
-       if (!Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand) {\r
+       if (!Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand) {\r
                if (nKey == VK_CONTROL\r
                 || nKey == VK_LCONTROL\r
                 || nKey == VK_RCONTROL\r
@@ -1103,12 +1123,12 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
        }\r
 \r
        if (CCommands::IsTemporarilyDisableXKeymacs()\r
-        && Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand != CCommands::KeyboardQuit) {\r
+        && Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand != CCommands::KeyboardQuit) {\r
                CCommands::SetTemporarilyDisableXKeymacs(FALSE);\r
                goto DO_NOTHING;\r
        }\r
 \r
-       if (m_bAtIbeamCursorOnly[m_nApplicationID][nCommandType][nKey]) {\r
+       if (m_Config.bAtIbeamCursorOnly[m_nApplicationID][nCommandType][nKey]) {\r
                CURSORINFO cursorinfo = { sizeof(cursorinfo) };\r
                if (GetCursorInfo(&cursorinfo) && cursorinfo.flags && cursorinfo.hCursor != LoadCursor(NULL, IDC_IBEAM)) {\r
                        goto DO_NOTHING;\r
@@ -1121,7 +1141,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
 \r
        if (!bLocked) {\r
                bLocked = TRUE;\r
-               fCommand = Commands[m_nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand;\r
+               fCommand = Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][nKey]].fCommand;\r
 RECURSIVE_COMMAND:\r
                switch (fCommand()) {\r
                case GOTO_DO_NOTHING:\r
@@ -1218,46 +1238,46 @@ void CXkeymacsDll::SetModifierIcons()
 \r
 void CXkeymacsDll::SetApplicationName(int nApplicationID, CString szApplicationName)\r
 {\r
-       ZeroMemory(m_szSpecialApp[nApplicationID], sizeof(m_szSpecialApp[nApplicationID]));\r
-       _tcsncpy(m_szSpecialApp[nApplicationID], szApplicationName, sizeof(m_szSpecialApp[nApplicationID]));\r
+       ZeroMemory(m_Config.szSpecialApp[nApplicationID], sizeof(m_Config.szSpecialApp[nApplicationID]));\r
+       _tcsncpy(m_Config.szSpecialApp[nApplicationID], szApplicationName, sizeof(m_Config.szSpecialApp[nApplicationID]));\r
 }\r
 \r
 void CXkeymacsDll::SetWindowText(int nApplicationID, CString szWindowText)\r
 {\r
-       ZeroMemory(m_szWindowText[nApplicationID], sizeof(m_szWindowText[nApplicationID]));\r
-       _tcsncpy(m_szWindowText[nApplicationID], szWindowText, sizeof(m_szWindowText[nApplicationID]));\r
+       ZeroMemory(m_Config.szWindowText[nApplicationID], sizeof(m_Config.szWindowText[nApplicationID]));\r
+       _tcsncpy(m_Config.szWindowText[nApplicationID], szWindowText, sizeof(m_Config.szWindowText[nApplicationID]));\r
 }\r
 \r
 void CXkeymacsDll::SetCommandID(int nApplicationID, int nCommandType, int nKey, int nCommandID)\r
 {\r
-       m_nCommandID[nApplicationID][nCommandType][nKey] = nCommandID;\r
+       m_Config.nCommandID[nApplicationID][nCommandType][nKey] = nCommandID;\r
 }\r
 \r
 void CXkeymacsDll::SetAtIbeamCursorOnly(int nApplicationID, int nCommandType, int nKey, BOOL bAtIbeamCursorOnly)\r
 {\r
-       m_bAtIbeamCursorOnly[nApplicationID][nCommandType][nKey] = bAtIbeamCursorOnly;\r
+       m_Config.bAtIbeamCursorOnly[nApplicationID][nCommandType][nKey] = bAtIbeamCursorOnly;\r
 }\r
 \r
 void CXkeymacsDll::SetKillRingMax(int nApplicationID, int nKillRingMax)\r
 {\r
-       m_nKillRingMax[nApplicationID] = nKillRingMax;\r
+       m_Config.nKillRingMax[nApplicationID] = nKillRingMax;\r
 }\r
 \r
 void CXkeymacsDll::SetUseDialogSetting(int nApplicationID, BOOL bUseDialogSetting)\r
 {\r
-       m_bUseDialogSetting[nApplicationID] = bUseDialogSetting;\r
+       m_Config.bUseDialogSetting[nApplicationID] = bUseDialogSetting;\r
 }\r
 \r
 // Clear data of nApplicationID\r
 void CXkeymacsDll::Clear(int nApplicationID)\r
 {\r
        if (0 <= nApplicationID && nApplicationID < MAX_APP) {\r
-               ZeroMemory(m_szSpecialApp[nApplicationID], sizeof(m_szSpecialApp[nApplicationID]));\r
-               ZeroMemory(m_nCommandID[nApplicationID], sizeof(m_nCommandID[nApplicationID]));\r
-               ZeroMemory(m_bAtIbeamCursorOnly[nApplicationID], sizeof(m_bAtIbeamCursorOnly[nApplicationID]));\r
-               m_nKillRingMax[nApplicationID] = 0;\r
-               m_bUseDialogSetting[nApplicationID] = FALSE;\r
-               m_nSettingStyle[nApplicationID] = 0;\r
+               ZeroMemory(m_Config.szSpecialApp[nApplicationID], sizeof(m_Config.szSpecialApp[nApplicationID]));\r
+               ZeroMemory(m_Config.nCommandID[nApplicationID], sizeof(m_Config.nCommandID[nApplicationID]));\r
+               ZeroMemory(m_Config.bAtIbeamCursorOnly[nApplicationID], sizeof(m_Config.bAtIbeamCursorOnly[nApplicationID]));\r
+               m_Config.nKillRingMax[nApplicationID] = 0;\r
+               m_Config.bUseDialogSetting[nApplicationID] = FALSE;\r
+               m_Config.nSettingStyle[nApplicationID] = 0;\r
        } else {\r
                ASSERT(0);\r
        }\r
@@ -1287,7 +1307,7 @@ BOOL CXkeymacsDll::IsDepressedModifier(int (__cdecl *Modifier)(void), BOOL bPhys
        do {\r
                if (IsValidKey(bVk)\r
                 && IsDown(bVk, bPhysicalKey)\r
-                && Commands[m_nCommandID[m_nApplicationID][NONE][bVk]].fCommand == Modifier) {\r
+                && Commands[m_Config.nCommandID[m_nApplicationID][NONE][bVk]].fCommand == Modifier) {\r
                        return TRUE;\r
                }\r
        } while (++bVk);\r
@@ -1329,7 +1349,7 @@ BOOL CXkeymacsDll::IsMeta()
 \r
 void CXkeymacsDll::AddKillRing(BOOL bNewData)\r
 {\r
-       if (m_nKillRingMax[m_nApplicationID] == 0) {\r
+       if (m_Config.nKillRingMax[m_nApplicationID] == 0) {\r
                return;\r
        }\r
 \r
@@ -1359,7 +1379,7 @@ void CXkeymacsDll::AddKillRing(BOOL bNewData)
 \r
        m_nKillRing = 0;\r
 \r
-       if (m_nKillRingMax[m_nApplicationID] < m_oKillRing.GetCount()) {\r
+       if (m_Config.nKillRingMax[m_nApplicationID] < m_oKillRing.GetCount()) {\r
                CClipboardSnap *pSnap = m_oKillRing.GetTail();\r
                delete pSnap;\r
                pSnap = NULL;\r
@@ -1371,7 +1391,7 @@ void CXkeymacsDll::AddKillRing(BOOL bNewData)
 // Return FALSE if there is no more data\r
 CClipboardSnap* CXkeymacsDll::GetKillRing(CClipboardSnap* pSnap, BOOL bForce)\r
 {\r
-       if (m_nKillRingMax[m_nApplicationID] == 0) {\r
+       if (m_Config.nKillRingMax[m_nApplicationID] == 0) {\r
                return NULL;\r
        }\r
 \r
@@ -1481,27 +1501,27 @@ int CXkeymacsDll::GetMickey(int nDifferential, int nThreshold1, int nThreshold2,
 \r
 void CXkeymacsDll::SetSettingStyle(int nApplicationID, int nSettingStyle)\r
 {\r
-       m_nSettingStyle[nApplicationID] = nSettingStyle;\r
+       m_Config.nSettingStyle[nApplicationID] = nSettingStyle;\r
 }\r
 \r
 void CXkeymacsDll::SetIgnoreUndefinedMetaCtrl(int nApplicationID, BOOL bIgnoreUndefinedMetaCtrl)\r
 {\r
-       m_bIgnoreUndefinedMetaCtrl[nApplicationID] = bIgnoreUndefinedMetaCtrl;\r
+       m_Config.bIgnoreUndefinedMetaCtrl[nApplicationID] = bIgnoreUndefinedMetaCtrl;\r
 }\r
 \r
 void CXkeymacsDll::SetIgnoreUndefinedC_x(int nApplicationID, BOOL bIgnoreUndefinedC_x)\r
 {\r
-       m_bIgnoreUndefinedC_x[nApplicationID] = bIgnoreUndefinedC_x;\r
+       m_Config.bIgnoreUndefinedC_x[nApplicationID] = bIgnoreUndefinedC_x;\r
 }\r
 \r
 void CXkeymacsDll::SetEnableCUA(int nApplicationID, BOOL bEnableCUA)\r
 {\r
-       m_bEnableCUA[nApplicationID] = bEnableCUA;\r
+       m_Config.bEnableCUA[nApplicationID] = bEnableCUA;\r
 }\r
 \r
 BOOL CXkeymacsDll::GetEnableCUA()\r
 {\r
-       return m_bEnableCUA[m_nApplicationID];\r
+       return m_Config.bEnableCUA[m_nApplicationID];\r
 }\r
 \r
 void CXkeymacsDll::DefiningMacro(BOOL bDefiningMacro)\r
@@ -1621,12 +1641,12 @@ void CXkeymacsDll::CallMacro()  // for debug
 \r
 void CXkeymacsDll::Set106Keyboard(BOOL b106Keyboard)\r
 {\r
-       m_b106Keyboard = b106Keyboard;\r
+       m_Config.b106Keyboard = b106Keyboard;\r
 }\r
 \r
 BOOL CXkeymacsDll::Is106Keyboard()\r
 {\r
-       return m_b106Keyboard;\r
+       return m_Config.b106Keyboard;\r
 }\r
 \r
 int CXkeymacsDll::IsPassThrough(BYTE nKey)\r
@@ -1634,7 +1654,7 @@ int CXkeymacsDll::IsPassThrough(BYTE nKey)
        BYTE bVk = 0;\r
        do {\r
                if (IsDown(bVk)\r
-                && (Commands[m_nCommandID[m_nApplicationID][NONE][bVk]].fCommand == CCommands::PassThrough)) {\r
+                && (Commands[m_Config.nCommandID[m_nApplicationID][NONE][bVk]].fCommand == CCommands::PassThrough)) {\r
                        if (bVk == nKey) {\r
                                return GOTO_HOOK;\r
                        }\r
@@ -1658,13 +1678,13 @@ void CXkeymacsDll::SetFunctionKey(int nFunctionID, int nApplicationID, int nComm
                return;\r
        }\r
 \r
-       m_nFunctionID[nApplicationID][nCommandType][nKey] = nFunctionID;\r
+       m_Config.nFunctionID[nApplicationID][nCommandType][nKey] = nFunctionID;\r
 }\r
 \r
 void CXkeymacsDll::ClearFunctionDefinition()\r
 {\r
-       memset(m_nFunctionID, -1, sizeof(m_nFunctionID));\r
-       memset(m_szFunctionDefinition, 0, sizeof(m_szFunctionDefinition));\r
+       memset(m_Config.nFunctionID, -1, sizeof(m_Config.nFunctionID));\r
+       memset(m_Config.szFunctionDefinition, 0, sizeof(m_Config.szFunctionDefinition));\r
 }\r
 \r
 void CXkeymacsDll::SetFunctionDefinition(int nFunctionID, CString szDefinition)\r
@@ -1673,8 +1693,8 @@ void CXkeymacsDll::SetFunctionDefinition(int nFunctionID, CString szDefinition)
                return;\r
        }\r
 \r
-       memset(m_szFunctionDefinition[nFunctionID], 0, sizeof(m_szFunctionDefinition[nFunctionID]));\r
-       _stprintf(m_szFunctionDefinition[nFunctionID], _T("%s"), szDefinition);\r
+       memset(m_Config.szFunctionDefinition[nFunctionID], 0, sizeof(m_Config.szFunctionDefinition[nFunctionID]));\r
+       _stprintf(m_Config.szFunctionDefinition[nFunctionID], _T("%s"), szDefinition);\r
 \r
        return;\r
 \r
@@ -1685,7 +1705,7 @@ void CXkeymacsDll::CallFunction(int nFunctionID)
 {\r
        CArray<KeyBind, KeyBind> keybinds;\r
 \r
-       if (nFunctionID < 0 || MAX_FUNCTION <= nFunctionID || !_tcslen(m_szFunctionDefinition[nFunctionID])) {\r
+       if (nFunctionID < 0 || MAX_FUNCTION <= nFunctionID || !_tcslen(m_Config.szFunctionDefinition[nFunctionID])) {\r
                return;\r
        }\r
 \r
@@ -1693,18 +1713,18 @@ void CXkeymacsDll::CallFunction(int nFunctionID)
        BOOL bIsAltDown = CXkeymacsDll::IsDown(VK_MENU);\r
        BOOL bIsShiftDown = CXkeymacsDll::IsDown(VK_SHIFT);\r
 \r
-       if (m_szFunctionDefinition[nFunctionID][0] == _T('"') && m_szFunctionDefinition[nFunctionID][_tcslen(m_szFunctionDefinition[nFunctionID]) - 1] == _T('"')) {\r
-               for (unsigned int i = 1; i < _tcslen(m_szFunctionDefinition[nFunctionID]) - 1; ++i) {   // skip '"'\r
+       if (m_Config.szFunctionDefinition[nFunctionID][0] == _T('"') && m_Config.szFunctionDefinition[nFunctionID][_tcslen(m_Config.szFunctionDefinition[nFunctionID]) - 1] == _T('"')) {\r
+               for (unsigned int i = 1; i < _tcslen(m_Config.szFunctionDefinition[nFunctionID]) - 1; ++i) {    // skip '"'\r
                        keybinds.Add(ParseKey(nFunctionID, i));\r
                }\r
-       } else if (m_szFunctionDefinition[nFunctionID][0] == _T('[') && m_szFunctionDefinition[nFunctionID][_tcslen(m_szFunctionDefinition[nFunctionID]) - 1] == _T(']')) {\r
-               for (unsigned int i = 1; i < _tcslen(m_szFunctionDefinition[nFunctionID]) - 1; ++i) {   // skip '[' and ']'\r
-                       if (m_szFunctionDefinition[nFunctionID][i] == _T('?')) {        // [?f ?o ?o]\r
+       } else if (m_Config.szFunctionDefinition[nFunctionID][0] == _T('[') && m_Config.szFunctionDefinition[nFunctionID][_tcslen(m_Config.szFunctionDefinition[nFunctionID]) - 1] == _T(']')) {\r
+               for (unsigned int i = 1; i < _tcslen(m_Config.szFunctionDefinition[nFunctionID]) - 1; ++i) {    // skip '[' and ']'\r
+                       if (m_Config.szFunctionDefinition[nFunctionID][i] == _T('?')) { // [?f ?o ?o]\r
                                ++i;\r
                                keybinds.Add(ParseKey(nFunctionID, i));\r
                        } else {                                                                                                // [ControlCharacter]\r
                                for (int nKeyID = 0; nKeyID < sizeof(ControlCharacters) / sizeof(ControlCharacters[0]); ++nKeyID) {\r
-                                       if (!_tcsncmp(m_szFunctionDefinition[nFunctionID] + i, ControlCharacters[nKeyID].name, _tcslen(ControlCharacters[nKeyID].name))) {\r
+                                       if (!_tcsncmp(m_Config.szFunctionDefinition[nFunctionID] + i, ControlCharacters[nKeyID].name, _tcslen(ControlCharacters[nKeyID].name))) {\r
                                                KeyBind keybind = {NONE, ControlCharacters[nKeyID].bVk};\r
                                                keybinds.Add(keybind);\r
                                                i += _tcslen(ControlCharacters[nKeyID].name);\r
@@ -1726,8 +1746,8 @@ void CXkeymacsDll::CallFunction(int nFunctionID)
                const int nCommandType = keybinds.GetAt(i).nCommandType;\r
                const BYTE bVk = keybinds.GetAt(i).bVk;\r
 \r
-               if (nCommandType < MAX_COMMAND_TYPE && Commands[m_nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand) {\r
-                       if (Commands[m_nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand == CCommands::ExecuteExtendedCommand) {\r
+               if (nCommandType < MAX_COMMAND_TYPE && Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand) {\r
+                       if (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand == CCommands::ExecuteExtendedCommand) {\r
                                bM_x = TRUE;\r
                        } else if (!bInitialized) {\r
                                if (bIsCtrlDown) {\r
@@ -1745,8 +1765,8 @@ void CXkeymacsDll::CallFunction(int nFunctionID)
 \r
                                bInitialized = TRUE;\r
                        }\r
-//                     CUtils::Log("CallFunction: Command Name: %s", Commands[m_nCommandID[m_nApplicationID][nCommandType][bVk]].szCommandName);\r
-                       while (Commands[m_nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand() == GOTO_RECURSIVE) {\r
+//                     CUtils::Log("CallFunction: Command Name: %s", Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].szCommandName);\r
+                       while (Commands[m_Config.nCommandID[m_nApplicationID][nCommandType][bVk]].fCommand() == GOTO_RECURSIVE) {\r
                                ;\r
                        }\r
                } else if (bM_x) {\r
@@ -1833,14 +1853,14 @@ KeyBind CXkeymacsDll::ParseKey(const int nFunctionID, unsigned int &i)
 {\r
        KeyBind keybind = {NONE};\r
 \r
-       if (m_szFunctionDefinition[nFunctionID][i] == _T('\\')) {\r
+       if (m_Config.szFunctionDefinition[nFunctionID][i] == _T('\\')) {\r
                ++i;\r
                BOOL bFound = FALSE;\r
                do {\r
                        bFound = FALSE;\r
                        for (int ModifierID = 0; ModifierID < sizeof(Modifiers) / sizeof(Modifiers[0]); ++ModifierID) {\r
-                               if (!_tcsncmp(m_szFunctionDefinition[nFunctionID] + i, Modifiers[ModifierID].name, _tcslen(Modifiers[ModifierID].name))\r
-                                && _tcslen(Modifiers[ModifierID].name) < _tcslen(m_szFunctionDefinition[nFunctionID] + i)) {\r
+                               if (!_tcsncmp(m_Config.szFunctionDefinition[nFunctionID] + i, Modifiers[ModifierID].name, _tcslen(Modifiers[ModifierID].name))\r
+                                && _tcslen(Modifiers[ModifierID].name) < _tcslen(m_Config.szFunctionDefinition[nFunctionID] + i)) {\r
                                        keybind.nCommandType |= Modifiers[ModifierID].id;\r
                                        i+= _tcslen(Modifiers[ModifierID].name);\r
                                        bFound = TRUE;\r
@@ -1848,12 +1868,12 @@ KeyBind CXkeymacsDll::ParseKey(const int nFunctionID, unsigned int &i)
                        }\r
                } while (bFound);\r
        }\r
-       if (IsShift(m_szFunctionDefinition[nFunctionID][i]) && !(keybind.nCommandType & (WIN_CTRL | WIN_ALT | WIN_WIN))) {\r
+       if (IsShift(m_Config.szFunctionDefinition[nFunctionID][i]) && !(keybind.nCommandType & (WIN_CTRL | WIN_ALT | WIN_WIN))) {\r
                keybind.nCommandType |= SHIFT;\r
        }\r
 \r
        for (int nKeyID = 0; nKeyID < sizeof(ControlCharacters) / sizeof(ControlCharacters[0]); ++nKeyID) {\r
-               if (!_tcsncmp(m_szFunctionDefinition[nFunctionID] + i, ControlCharacters[nKeyID].name, _tcslen(ControlCharacters[nKeyID].name))) {\r
+               if (!_tcsncmp(m_Config.szFunctionDefinition[nFunctionID] + i, ControlCharacters[nKeyID].name, _tcslen(ControlCharacters[nKeyID].name))) {\r
                        i += _tcslen(ControlCharacters[nKeyID].name);\r
                        break;\r
                }\r
@@ -1861,7 +1881,7 @@ KeyBind CXkeymacsDll::ParseKey(const int nFunctionID, unsigned int &i)
        if (nKeyID < sizeof(ControlCharacters) / sizeof(ControlCharacters[0])) {\r
                keybind.bVk = ControlCharacters[nKeyID].bVk;\r
        } else {\r
-               keybind.bVk = a2v(m_szFunctionDefinition[nFunctionID][i]);\r
+               keybind.bVk = a2v(m_Config.szFunctionDefinition[nFunctionID][i]);\r
        }\r
 \r
        return keybind;\r
@@ -1880,7 +1900,7 @@ BOOL CXkeymacsDll::IsShift(TCHAR nAscii)
        case _T('&'):\r
                return TRUE;\r
        case _T('\''):\r
-               return m_b106Keyboard;\r
+               return m_Config.b106Keyboard;\r
        case _T('('):\r
        case _T(')'):\r
        case _T('*'):\r
@@ -1893,18 +1913,18 @@ BOOL CXkeymacsDll::IsShift(TCHAR nAscii)
        case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'): case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'):\r
                return FALSE;\r
        case _T(':'):\r
-               return !m_b106Keyboard;\r
+               return !m_Config.b106Keyboard;\r
        case _T(';'):\r
                return FALSE;\r
        case _T('<'):\r
                return TRUE;\r
        case _T('='):\r
-               return m_b106Keyboard;\r
+               return m_Config.b106Keyboard;\r
        case _T('>'):\r
        case _T('?'):\r
                return TRUE;\r
        case _T('@'):\r
-               return !m_b106Keyboard;\r
+               return !m_Config.b106Keyboard;\r
        case _T('A'): case _T('B'): case _T('C'): case _T('D'): case _T('E'): case _T('F'): case _T('G'): case _T('H'): case _T('I'): case _T('J'): \r
        case _T('K'): case _T('L'): case _T('M'): case _T('N'): case _T('O'): case _T('P'): case _T('Q'): case _T('R'): case _T('S'): case _T('T'): \r
        case _T('U'): case _T('V'): case _T('W'): case _T('X'): case _T('Y'): case _T('Z'): \r
@@ -1914,11 +1934,11 @@ BOOL CXkeymacsDll::IsShift(TCHAR nAscii)
        case _T(']'):\r
                return FALSE;\r
        case _T('^'):\r
-               return !m_b106Keyboard;\r
+               return !m_Config.b106Keyboard;\r
        case _T('_'):\r
                return TRUE;\r
        case _T('`'):\r
-               return m_b106Keyboard;\r
+               return m_Config.b106Keyboard;\r
        case _T('a'): case _T('b'): case _T('c'): case _T('d'): case _T('e'): case _T('f'): case _T('g'): case _T('h'): case _T('i'): case _T('j'): \r
        case _T('k'): case _T('l'): case _T('m'): case _T('n'): case _T('o'): case _T('p'): case _T('q'): case _T('r'): case _T('s'): case _T('t'): \r
        case _T('u'): case _T('v'): case _T('w'): case _T('x'): case _T('y'): case _T('z'): \r
@@ -1941,7 +1961,7 @@ BYTE CXkeymacsDll::a2v(TCHAR nAscii)
        case _T('!'):\r
                return '1';\r
        case _T('"'):\r
-               return m_b106Keyboard ? '2' : (BYTE) 0xde;      // VK_OEM_7\r
+               return m_Config.b106Keyboard ? '2' : (BYTE) 0xde;       // VK_OEM_7\r
        case _T('#'):\r
                return '3';\r
        case _T('$'):\r
@@ -1949,15 +1969,15 @@ BYTE CXkeymacsDll::a2v(TCHAR nAscii)
        case _T('%'):\r
                return '5';\r
        case _T('&'):\r
-               return m_b106Keyboard ? '6' : '7';\r
+               return m_Config.b106Keyboard ? '6' : '7';\r
        case _T('\''):\r
-               return m_b106Keyboard ? '7' : (BYTE) 0xde;      // VK_OEM_7\r
+               return m_Config.b106Keyboard ? '7' : (BYTE) 0xde;       // VK_OEM_7\r
        case _T('('):\r
-               return m_b106Keyboard ? '8' : '9';\r
+               return m_Config.b106Keyboard ? '8' : '9';\r
        case _T(')'):\r
-               return m_b106Keyboard ? '9' : '0';\r
+               return m_Config.b106Keyboard ? '9' : '0';\r
        case _T('*'):\r
-               return m_b106Keyboard ? (BYTE) 0xba : '8';      // VK_OEM_1\r
+               return m_Config.b106Keyboard ? (BYTE) 0xba : '8';       // VK_OEM_1\r
        case _T('+'):\r
                return 0xbb;    // VK_OEM_PLUS\r
        case _T(','):\r
@@ -1973,17 +1993,17 @@ BYTE CXkeymacsDll::a2v(TCHAR nAscii)
        case _T(':'):\r
                return 0xba;    // VK_OEM_1\r
        case _T(';'):\r
-               return m_b106Keyboard ? (BYTE) 0xbb : (BYTE) 0xba;      // VK_OEM_PLUS  VK_OEM_1\r
+               return m_Config.b106Keyboard ? (BYTE) 0xbb : (BYTE) 0xba;       // VK_OEM_PLUS  VK_OEM_1\r
        case _T('<'):\r
                return 0xbc;    // VK_OEM_COMMA\r
        case _T('='):\r
-               return m_b106Keyboard ? (BYTE) 0xbd : (BYTE) 0xbb;      // VK_OEM_MINUS VK_OEM_PLUS\r
+               return m_Config.b106Keyboard ? (BYTE) 0xbd : (BYTE) 0xbb;       // VK_OEM_MINUS VK_OEM_PLUS\r
        case _T('>'):\r
                return 0xbe;    // VK_OEM_PERIOD\r
        case _T('?'):\r
                return 0xbf;    // VK_OEM_2\r
        case _T('@'):\r
-               return m_b106Keyboard ? (BYTE) 0xc0 : '2';\r
+               return m_Config.b106Keyboard ? (BYTE) 0xc0 : '2';\r
        case _T('A'): case _T('B'): case _T('C'): case _T('D'): case _T('E'): case _T('F'): case _T('G'): case _T('H'): case _T('I'): case _T('J'): \r
        case _T('K'): case _T('L'): case _T('M'): case _T('N'): case _T('O'): case _T('P'): case _T('Q'): case _T('R'): case _T('S'): case _T('T'): \r
        case _T('U'): case _T('V'): case _T('W'): case _T('X'): case _T('Y'): case _T('Z'): \r
@@ -1995,9 +2015,9 @@ BYTE CXkeymacsDll::a2v(TCHAR nAscii)
        case _T(']'):\r
                return 0xdd;    // VK_OEM_6\r
        case _T('^'):\r
-               return m_b106Keyboard ? (BYTE) 0xde : '6';      // VK_OEM_7\r
+               return m_Config.b106Keyboard ? (BYTE) 0xde : '6';       // VK_OEM_7\r
        case _T('_'):\r
-               return m_b106Keyboard ? (BYTE) 0xe2 : (BYTE) 0xbd;      // VK_OEM_102   VK_OEM_MINUS\r
+               return m_Config.b106Keyboard ? (BYTE) 0xe2 : (BYTE) 0xbd;       // VK_OEM_102   VK_OEM_MINUS\r
        case _T('`'):\r
                return 0xc0;    // VK_OEM_3\r
        case _T('a'): case _T('b'): case _T('c'): case _T('d'): case _T('e'): case _T('f'): case _T('g'): case _T('h'): case _T('i'): case _T('j'): \r
@@ -2011,7 +2031,7 @@ BYTE CXkeymacsDll::a2v(TCHAR nAscii)
        case _T('}'):\r
                return 0xdd;    // VK_OEM_6\r
        case _T('~'):\r
-               return m_b106Keyboard ? (BYTE) 0xde : (BYTE) 0xc0;      // VK_OEM_7     VK_OEM_3\r
+               return m_Config.b106Keyboard ? (BYTE) 0xde : (BYTE) 0xc0;       // VK_OEM_7     VK_OEM_3\r
        default:\r
                return 0;\r
        }\r
@@ -2096,12 +2116,12 @@ void CXkeymacsDll::DoSetCursor()
 \r
 void CXkeymacsDll::Set326Compatible(int nApplicationID, BOOL b326Compatible)\r
 {\r
-       m_b326Compatible[nApplicationID] = b326Compatible;\r
+       m_Config.b326Compatible[nApplicationID] = b326Compatible;\r
 }\r
 \r
 BOOL CXkeymacsDll::Get326Compatible()\r
 {\r
-       return m_b326Compatible[m_nApplicationID];\r
+       return m_Config.b326Compatible[m_nApplicationID];\r
 }\r
 \r
 void CXkeymacsDll::InvokeM_x(const TCHAR *const szPath)\r
index 7309410..6b30e3e 100644 (file)
@@ -53,6 +53,8 @@ struct KeyName
 class AFX_EXT_CLASS CXkeymacsDll  \r
 {\r
 public:\r
+       static BOOL SaveConfig();\r
+       static BOOL LoadConfig();\r
        static void SetM_xTip(const TCHAR *const szPath);\r
        static BOOL Get326Compatible();\r
        static void Set326Compatible(int nApplicationID, BOOL b326Compatible);\r
@@ -74,6 +76,7 @@ public:
        static void SetIgnoreUndefinedC_x(int nApplicationID, BOOL bIgnoreUndefinedC_x);\r
        static void SetIgnoreUndefinedMetaCtrl(int nApplicationID, BOOL bIgnoreUndefinedMetaCtrl);\r
        static void SetHooks();\r
+       static void EnableKeyboardHook();\r
        static void SetKeyboardHook();\r
        static void SetSettingStyle(int nApplicationID, int nSettingStyle);\r
        static void SetUseDialogSetting(int nApplicationID, BOOL bUseDialogSetting);\r
@@ -100,7 +103,6 @@ public:
 private:\r
        static TCHAR m_M_xTip[128];\r
        static void InvokeM_x(const TCHAR* const szPath);\r
-       static BOOL m_b326Compatible[MAX_APP];\r
        static void LogCallWndProcMessage(WPARAM wParam, LPARAM lParam);\r
        static void DoSetCursor();\r
        static HCURSOR m_hCurrentCursor;\r
@@ -111,7 +113,6 @@ private:
        static HHOOK m_hHookCallWndRet;\r
        static LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam);\r
        static BOOL IsMatchWindowText(CString szWindowText);\r
-       static TCHAR m_szWindowText[MAX_APP][WINDOW_TEXT_LENGTH];\r
        static BOOL m_bEnableKeyboardHook;\r
        static HHOOK m_hHookCallWnd;\r
        static HHOOK m_hHookGetMessage;\r
@@ -128,12 +129,7 @@ private:
        static KeyBind ParseKey(const int nFunctionID, unsigned int &i);\r
        static BYTE a2v(TCHAR nAscii);\r
        static BOOL IsShift(TCHAR nAscii);\r
-       static TCHAR m_szFunctionDefinition[MAX_FUNCTION][MAX_DEFINITION];\r
        static void CallFunction(int nFunctionID);\r
-       static int m_nFunctionID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
-       static BOOL m_bEnableCUA[MAX_APP];\r
-       static TCHAR m_szOldApplicationName[MAX_PATH];\r
-       static TCHAR m_szApplicationName[MAX_PATH];\r
        static int IsPassThrough(BYTE nKey);\r
        static BOOL IsDepressedShiftKeyOnly(BYTE nKey);\r
        static BOOL IsDepressedModifier(int Modifier(), BOOL bPhysicalKey = TRUE);\r
@@ -142,25 +138,17 @@ private:
        static BOOL m_bDefiningMacro;\r
        static void Original(int nCommandType, BYTE bVk, int nOriginal);\r
        static int Original(int nCommandType, BYTE bVk);\r
-       static BOOL m_bUseDialogSetting[MAX_APP];\r
        static void InitKeyboardProc(BOOL bImeComposition);\r
-       static BOOL m_bIgnoreUndefinedC_x[MAX_APP];\r
-       static BOOL m_bIgnoreUndefinedMetaCtrl[MAX_APP];\r
-       static int m_nSettingStyle[MAX_APP];\r
        static int m_nApplicationID;\r
        static int m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY];\r
        static int m_nKillRing;\r
        static CList<CClipboardSnap *, CClipboardSnap *> m_oKillRing;\r
-       static int m_nKillRingMax[MAX_APP];\r
        static int GetMickey(int nDifferential, int nThreshold1, int nThreshold2, int nAcceleration, int nSpeed);\r
        static BOOL m_bHook;\r
        static BOOL m_bRightShift;\r
        static BOOL m_bRightAlt;\r
        static BOOL m_bRightControl;\r
-       static TCHAR m_szSpecialApp[MAX_APP][CLASS_NAME_LENGTH];\r
-       static int m_nCommandID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
-       static BOOL m_bAtIbeamCursorOnly[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
-       static BOOL m_b106Keyboard;\r
+       static CONFIG m_Config;\r
 };\r
 \r
 #endif // !defined(AFX_XKEYMACS_H__88552DEC_1233_4A0A_BE62_9EF7BC618EC6__INCLUDED_)\r