XKeymacs for 64bit Windows
Revisão | 6d0ba6d7e3d96d3503c139ee1d04c4eb1dd06bea (tree) |
---|---|
Hora | 2011-05-27 08:38:38 |
Autor | Kazuhiro Fujieda <fujieda@user...> |
Commiter | Kazuhiro Fujieda |
Remove typedef of Translate_t and the declaration of struct
Translate and enum Instance in xkeymacs/xkeymacs.h. Remove
m_Instance in CXkeymacsApp. Remove CXkeymacsApp::OnAppAbout.
@@ -5,7 +5,6 @@ | ||
5 | 5 | #include "stdafx.h" |
6 | 6 | #include <direct.h> |
7 | 7 | #include <Shlwapi.h> |
8 | -#include "xkeymacs.h" | |
9 | 8 | #include "DotXkeymacs.h" |
10 | 9 | |
11 | 10 | #ifdef _DEBUG |
@@ -276,10 +275,13 @@ LPCTSTR CDotXkeymacs::GetLanguage() | ||
276 | 275 | LPVOID lpData = malloc(dwLen); |
277 | 276 | |
278 | 277 | if (lpData && GetFileVersionInfo(lptstrFilename, NULL, dwLen, lpData)) { |
279 | - Translate_t *lpTranslate; | |
278 | + struct Translate { | |
279 | + WORD wLanguage; | |
280 | + WORD wCodePage; | |
281 | + } *lpTranslate; | |
280 | 282 | UINT cbTranslate = 0; |
281 | 283 | |
282 | - if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate_t) <= cbTranslate) { | |
284 | + if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate) <= cbTranslate) { | |
283 | 285 | for (int i = 0; i < sizeof(Languages)/sizeof(Languages[0]); ++i) { |
284 | 286 | if (Languages[i].wLanguage == lpTranslate->wLanguage) { |
285 | 287 | szLanguage = Languages[i].szLanguage; |
@@ -17,13 +17,9 @@ static char THIS_FILE[] = __FILE__; | ||
17 | 17 | |
18 | 18 | BEGIN_MESSAGE_MAP(CXkeymacsApp, CWinApp) |
19 | 19 | //{{AFX_MSG_MAP(CXkeymacsApp) |
20 | - ON_COMMAND(ID_APP_ABOUT, OnAppAbout) | |
21 | 20 | // NOTE - the ClassWizard will add and remove mapping macros here. |
22 | 21 | // DO NOT EDIT what you see in these blocks of generated code! |
23 | 22 | //}}AFX_MSG_MAP |
24 | - // Standard file based document commands | |
25 | - ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) | |
26 | - ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) | |
27 | 23 | END_MESSAGE_MAP() |
28 | 24 | |
29 | 25 | ///////////////////////////////////////////////////////////////////////////// |
@@ -31,7 +27,7 @@ END_MESSAGE_MAP() | ||
31 | 27 | |
32 | 28 | CXkeymacsApp::CXkeymacsApp() |
33 | 29 | { |
34 | - m_Instance = FirstInstance; | |
30 | + m_hMutex = NULL; | |
35 | 31 | } |
36 | 32 | |
37 | 33 | ///////////////////////////////////////////////////////////////////////////// |
@@ -55,10 +51,9 @@ BOOL CXkeymacsApp::InitInstance() | ||
55 | 51 | #else |
56 | 52 | m_hMutex = CreateMutex(FALSE, 0, CString(MAKEINTRESOURCE(AFX_IDS_APP_TITLE))); |
57 | 53 | #endif |
58 | - | |
59 | - if (::GetLastError() == ERROR_ALREADY_EXISTS) { | |
60 | - m_Instance = SecondInstance; | |
61 | - CloseHandle( m_hMutex ); | |
54 | + if (GetLastError() == ERROR_ALREADY_EXISTS) { | |
55 | + CloseHandle(m_hMutex); | |
56 | + m_hMutex = NULL; | |
62 | 57 | return FALSE; |
63 | 58 | } |
64 | 59 |
@@ -129,9 +124,12 @@ CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) | ||
129 | 124 | wRevisionVersion = (WORD)((pInfo->dwProductVersionLS ) & 0xffff); |
130 | 125 | } |
131 | 126 | |
132 | - Translate_t *lpTranslate = NULL; | |
127 | + struct Translate { | |
128 | + WORD wLanguage; | |
129 | + WORD wCodePage; | |
130 | + } *lpTranslate = NULL; | |
133 | 131 | UINT cbTranslate = 0; |
134 | - if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate_t) <= cbTranslate) { | |
132 | + if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), (LPVOID*)&lpTranslate, &cbTranslate) && sizeof(Translate) <= cbTranslate) { | |
135 | 133 | LPVOID lpLegalCopyright = NULL; |
136 | 134 | UINT uLen = 0; |
137 | 135 | CString SubBlock; |
@@ -180,22 +178,15 @@ BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) | ||
180 | 178 | //}}AFX_MSG_MAP |
181 | 179 | END_MESSAGE_MAP() |
182 | 180 | |
183 | -// App command to run the dialog | |
184 | -void CXkeymacsApp::OnAppAbout() | |
185 | -{ | |
186 | - CAboutDlg aboutDlg; | |
187 | - aboutDlg.DoModal(); | |
188 | -} | |
189 | - | |
190 | 181 | ///////////////////////////////////////////////////////////////////////////// |
191 | 182 | // CXkeymacsApp message handlers |
192 | 183 | |
193 | 184 | |
194 | 185 | int CXkeymacsApp::ExitInstance() |
195 | 186 | { |
196 | - if (m_Instance == FirstInstance) { | |
197 | - ReleaseMutex( m_hMutex ); | |
198 | - CloseHandle( m_hMutex ); | |
187 | + if (m_hMutex) { | |
188 | + ReleaseMutex(m_hMutex); | |
189 | + CloseHandle(m_hMutex); | |
199 | 190 | |
200 | 191 | m_pMainWnd->DestroyWindow(); |
201 | 192 | delete m_pMainWnd; |
@@ -14,13 +14,6 @@ | ||
14 | 14 | |
15 | 15 | #include "resource.h" // main symbols |
16 | 16 | |
17 | -enum Instance | |
18 | -{ | |
19 | - FirstInstance, | |
20 | - SecondInstance, | |
21 | -}; | |
22 | - | |
23 | - | |
24 | 17 | ///////////////////////////////////////////////////////////////////////////// |
25 | 18 | // CXkeymacsApp: |
26 | 19 | // See xkeymacs.cpp for the implementation of this class |
@@ -41,13 +34,11 @@ public: | ||
41 | 34 | |
42 | 35 | // Implementation |
43 | 36 | //{{AFX_MSG(CXkeymacsApp) |
44 | - afx_msg void OnAppAbout(); | |
45 | 37 | // NOTE - the ClassWizard will add and remove member functions here. |
46 | 38 | // DO NOT EDIT what you see in these blocks of generated code ! |
47 | 39 | //}}AFX_MSG |
48 | 40 | DECLARE_MESSAGE_MAP() |
49 | 41 | private: |
50 | - Instance m_Instance; | |
51 | 42 | HANDLE m_hMutex; |
52 | 43 | }; |
53 | 44 |
@@ -87,11 +78,6 @@ protected: | ||
87 | 78 | |
88 | 79 | ///////////////////////////////////////////////////////////////////////////// |
89 | 80 | |
90 | -typedef struct Translate { | |
91 | - WORD wLanguage; | |
92 | - WORD wCodePage; | |
93 | -} Translate_t; | |
94 | - | |
95 | 81 | //{{AFX_INSERT_LOCATION}} |
96 | 82 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. |
97 | 83 |