- const int nDefalutLevel = 0;\r
- const int nLatestLevel = 4;\r
-\r
- CString szSection;\r
- CString szEntry;\r
- szEntry.Format(_T("Level"));\r
-\r
- switch (AfxGetApp()->GetProfileInt(szSection, szEntry, nDefalutLevel)) {\r
- case nDefalutLevel:\r
- {\r
- for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
- CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
-\r
- CString szApplicationName;\r
- szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
- if (szApplicationName.IsEmpty()) {\r
- continue;\r
- }\r
-\r
- AddKeyBind2C_(szApplicationName, VK_LCONTROL);\r
- AddKeyBind2C_(szApplicationName, VK_RCONTROL);\r
- }\r
- }\r
- // Do NOT write break; here.\r
- case 1:\r
- {\r
- for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
- CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
-\r
- CString szApplicationName;\r
- szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
- if (szApplicationName.IsEmpty()) {\r
- continue;\r
- }\r
-\r
- // Set kill-ring-max 1 if it is 0.\r
- if (!AfxGetApp()->GetProfileInt(szApplicationName, CString(MAKEINTRESOURCE(IDS_REG_ENTRY_KILL_RING_MAX)), 0)) {\r
- AfxGetApp()->WriteProfileInt(szApplicationName, CString(MAKEINTRESOURCE(IDS_REG_ENTRY_KILL_RING_MAX)), 1);\r
- }\r
- }\r
- }\r
- // Do NOT write break; here.\r
- case 2:\r
- {\r
- for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
- CString szEntry;\r
- szEntry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
-\r
- CString szApplicationName;\r
- szApplicationName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), szEntry);\r
- if (szApplicationName.IsEmpty()) {\r
- continue;\r
- }\r
-\r
+ const int nCurrentLevel = AfxGetApp()->GetProfileInt(_T(""), _T("Level"), 0);\r
+ for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
+ CString entry;\r
+ entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
+ const CString appName = AfxGetApp()->GetProfileString(CString(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION)), entry);\r
+ if (appName.IsEmpty())\r
+ continue;\r
+ switch (nCurrentLevel) {\r
+ case 0:\r
+ AddKeyBind2C_(appName, VK_LCONTROL);\r
+ AddKeyBind2C_(appName, VK_RCONTROL);\r
+ // fall through\r
+ case 1:\r
+ // Set kill-ring-max 1 if it is 0.\r
+ if (!AfxGetApp()->GetProfileInt(appName, CString(MAKEINTRESOURCE(IDS_REG_ENTRY_KILL_RING_MAX)), 0))\r
+ AfxGetApp()->WriteProfileInt(appName, CString(MAKEINTRESOURCE(IDS_REG_ENTRY_KILL_RING_MAX)), 1);\r
+ // fall through\r
+ case 2:\r
+ {\r