Correct parameters for the debug build in the project files.
Solve warnings in the debug build.
Remove invalid references to the resource AFX_IDS_APP_TITLE.
Modify PollIPCMessage to send the main window a WM_CLOSE message on
terminating the process.
\r
CMainFrame::CMainFrame()\r
{\r
+ LPCTSTR title = _T("XKeymacs64");\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.hCursor = NULL;\r
stWndClass.hbrBackground = (HBRUSH)COLOR_BACKGROUND;\r
stWndClass.lpszMenuName = NULL;\r
- stWndClass.lpszClassName = szClassName;\r
-\r
+ stWndClass.lpszClassName = title;\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
+ CRect rect(0, 0, 100, 100);\r
+ Create(title , title, WS_OVERLAPPEDWINDOW | WS_MINIMIZE, rect);\r
}\r
\r
<ClCompile>\r
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <WarningLevel>Level3</WarningLevel>\r
+ <WarningLevel>Level4</WarningLevel>\r
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>C:\WinDDK\7600.16385.1\inc\mfc42</AdditionalIncludeDirectories>\r
- <ForceConformanceInForLoopScope>false</ForceConformanceInForLoopScope>\r
+ <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>\r
</ClCompile>\r
<Link>\r
<GenerateDebugInformation>true</GenerateDebugInformation>\r
\r
CXkeymacsApp theApp;\r
\r
-static UINT PollIPCMessage(LPVOID lpParam);\r
+static UINT PollIPCMessage(LPVOID param);\r
static void Start32bitProcess();\r
\r
BOOL CXkeymacsApp::InitInstance()\r
m_pMainWnd->ShowWindow(SW_HIDE);\r
m_pMainWnd->UpdateWindow();\r
\r
- AfxBeginThread(PollIPCMessage, NULL);\r
+ AfxBeginThread(PollIPCMessage, m_pMainWnd);\r
if (start32bit)\r
Start32bitProcess();\r
CXkeymacsDll::SetHooks();\r
return TRUE;\r
}\r
\r
-UINT PollIPCMessage(LPVOID lpParam)\r
+UINT PollIPCMessage(LPVOID param)\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
exit:\r
CloseHandle(hPipe);\r
CXkeymacsDll::ReleaseHooks();\r
- ExitProcess(0);\r
+ reinterpret_cast<CMainFrame *>(param)->SendMessage(WM_CLOSE);\r
return 0;\r
}\r
\r
\r
int CXkeymacsApp::ExitInstance() \r
{\r
- if (m_hMutex) {\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
<ClCompile>\r
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_AFXEXT;XKEYMACSDLLVC10_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
- <WarningLevel>Level3</WarningLevel>\r
+ <WarningLevel>Level4</WarningLevel>\r
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
<Optimization>Disabled</Optimization>\r
<AdditionalIncludeDirectories>C:\WinDDK\7600.16385.1\inc\mfc42</AdditionalIncludeDirectories>\r
- <ForceConformanceInForLoopScope>false</ForceConformanceInForLoopScope>\r
+ <ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>\r
</ClCompile>\r
<Link>\r
<GenerateDebugInformation>true</GenerateDebugInformation>\r
const BYTE nOrigKey = static_cast<BYTE>(wParam);\r
const bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
const bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
+ BYTE nKey = nOrigKey;\r
\r
static BOOL bLocked = FALSE;\r
static const BYTE RECURSIVE_KEY = 0x07;\r
\r
CancelMarkWithShift(nOrigKey, bRelease);\r
\r
- BYTE nKey = nOrigKey;\r
switch (nKey) {\r
case VK_CONTROL:\r
nKey = bExtended ? VK_RCONTROL : VK_LCONTROL;\r