• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

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

XKeymacs for 64bit Windows


Commit MetaInfo

Révisiondd6b078bb17f6a03cf8e6a5c3413e17e91550dcc (tree)
l'heure2011-05-27 08:36:10
AuteurKazuhiro Fujieda <fujieda@user...>
CommiterKazuhiro Fujieda

Message de Log

Rewrite CProfile::GetTaskList.

Delete PROCESS_SIZE macro. Make m_TaskList and m_dwTasks in CProfile
private. GetTaskList operates them directly. Remove arguments and
the return value of it. Remove code to delete directory names in it.

Change Summary

Modification

--- a/xkeymacs/profile.cpp
+++ b/xkeymacs/profile.cpp
@@ -1108,7 +1108,7 @@ void CProfile::InitApplicationList(CComboBox *const cApplicationList)
11081108 {
11091109 cApplicationList->ResetContent();
11101110
1111- m_dwTasks = GetTaskList(m_TaskList, MAX_TASKS);
1111+ GetTaskList();
11121112
11131113 EnumWindows(EnumWindowsProc, (LPARAM)cApplicationList);
11141114
@@ -1171,39 +1171,24 @@ void CProfile::InitApplicationList(CComboBox *const cApplicationList)
11711171 cApplicationList->SelectString(-1, CString(MAKEINTRESOURCE(IDS_DEFAULT_TITLE)));
11721172 }
11731173
1174-DWORD CProfile::GetTaskList(PTASK_LIST pTask, const DWORD dwNumTasks)
1174+void CProfile::GetTaskList()
11751175 {
1176- for (int i = 0; i < MAX_TASKS; ++i) {
1177- ZeroMemory(&pTask[i], sizeof(PTASK_LIST));
1178- }
1176+ ZeroMemory(m_TaskList, sizeof(m_TaskList));
11791177
11801178 HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
1181- if (hProcessSnap == (HANDLE)-1) {
1182- return 0;
1183- }
1179+ if (hProcessSnap == (HANDLE)-1)
1180+ return;
11841181
1185- DWORD dwTaskCount = 0;
1182+ m_dwTasks = 0;
11861183 PROCESSENTRY32 processEntry32 = {sizeof(PROCESSENTRY32)};
11871184 if (Process32First(hProcessSnap, &processEntry32)) {
11881185 do {
1189- LPTSTR pCurChar = NULL;
1190- for (pCurChar = processEntry32.szExeFile + lstrlen(processEntry32.szExeFile); *pCurChar != _T('\\') && pCurChar != processEntry32.szExeFile; --pCurChar) {
1191- ;
1192- }
1193- if (*pCurChar == _T('\\')) {
1194- ++pCurChar;
1195- }
1196-
1197- lstrcpy(pTask->ProcessName, pCurChar);
1198- pTask->dwProcessId = processEntry32.th32ProcessID;
1199-
1200- ++dwTaskCount;
1201- ++pTask;
1202- } while (dwTaskCount < dwNumTasks && Process32Next(hProcessSnap, &processEntry32));
1186+ lstrcpy(m_TaskList[m_dwTasks].ProcessName, processEntry32.szExeFile);
1187+ m_TaskList[m_dwTasks++].dwProcessId = processEntry32.th32ProcessID;
1188+ } while (m_dwTasks < MAX_TASKS && Process32Next(hProcessSnap, &processEntry32));
12031189 }
12041190
12051191 CloseHandle(hProcessSnap);
1206- return dwTaskCount;
12071192 }
12081193
12091194 // return application index
--- a/xkeymacs/profile.h
+++ b/xkeymacs/profile.h
@@ -12,11 +12,9 @@
1212 #include <winperf.h> // for Windows NT
1313 #include "resource.h"
1414
15-#define PROCESS_SIZE MAX_PATH
16-
1715 struct TASK_LIST {
1816 DWORD dwProcessId;
19- CHAR ProcessName[PROCESS_SIZE];
17+ CHAR ProcessName[MAX_PATH];
2018 };
2119 typedef TASK_LIST *PTASK_LIST;
2220
@@ -206,8 +204,6 @@ public:
206204 static void GetApplicationTitle(CComboBox *cApplicationList, CString &rList, int nIndex = -1);
207205 static BOOL IsDefault(CString sz);
208206 static int GetApplicationIndex(CString szApplicationName, BOOL bSaveAndValidate, int *nSettingStyle);
209- static TASK_LIST m_TaskList[MAX_TASKS];
210- static DWORD m_dwTasks;
211207 static void InitApplicationList(CComboBox *cApplicationList);
212208 static int GetSavedSettingCount();
213209 static void ClearData(CString szCurrentApplication);
@@ -242,7 +238,9 @@ private:
242238 static void SetDllData();
243239 static CXkeymacsData m_XkeymacsData[MAX_APP];
244240 static void DeleteAllRegistryData();
245- static DWORD GetTaskList(PTASK_LIST pTask, DWORD dwNumTasks);
241+ static TASK_LIST m_TaskList[MAX_TASKS];
242+ static DWORD m_dwTasks;
243+ static void GetTaskList();
246244 static BOOL IsCommandType(int nCommandType, LPCTSTR szKeyBind);
247245 static int KeyBind2Key(LPCTSTR szKey);
248246 static int KeyBind2CommandType(LPCTSTR szKeyBind);