OSDN Git Service

Solve problems in the debug build.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Wed, 2 Nov 2011 05:31:25 +0000 (14:31 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Fri, 4 Nov 2011 06:11:46 +0000 (15:11 +0900)
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.

xkeymacs/mainfrm64.cpp
xkeymacs/xkeymacs-vc10.vcxproj
xkeymacs/xkeymacs64.cpp
xkeymacsdll/xkeymacsdll-vc10.vcxproj
xkeymacsdll/xkeymacsdll.cpp

index a48c0a3..48574e7 100644 (file)
@@ -4,10 +4,10 @@ IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
 \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
@@ -17,13 +17,11 @@ CMainFrame::CMainFrame()
        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
index 72262d5..04932f0 100644 (file)
     <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
index 70d61ae..a8558f7 100644 (file)
@@ -9,7 +9,7 @@ CXkeymacsApp::CXkeymacsApp()
 \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
@@ -30,14 +30,14 @@ BOOL CXkeymacsApp::InitInstance()
        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
@@ -69,7 +69,7 @@ UINT PollIPCMessage(LPVOID lpParam)
 exit:\r
        CloseHandle(hPipe);\r
        CXkeymacsDll::ReleaseHooks();\r
-       ExitProcess(0);\r
+       reinterpret_cast<CMainFrame *>(param)->SendMessage(WM_CLOSE);\r
        return 0;\r
 }\r
 \r
@@ -95,13 +95,7 @@ void Start32bitProcess()
 \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
index 734f53c..6b2329c 100644 (file)
     <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
index 92326c2..d1ef4fd 100644 (file)
@@ -483,6 +483,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
        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
@@ -509,7 +510,6 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
 \r
        CancelMarkWithShift(nOrigKey, bRelease);\r
 \r
-       BYTE nKey = nOrigKey;\r
        switch (nKey) {\r
        case VK_CONTROL:\r
                nKey = bExtended ? VK_RCONTROL : VK_LCONTROL;\r