post by tommy @ 02 六月, 2013 21:13
之前有提過 用 Console 這個程式來取代 Command Prompt, 也提到修正中文顯示的方式. 不過, 最近發現無法輸入中文...
Google 找了一下, 發現有人做出了修正. 就照著自己改了一下, 然後重新 build 一個版本出來, 果然可以正常的輸入中文.
patch 的內容如下:
--- Console/ConsoleView.cpp.orig 2013-06-02 21:11:47.192427700 +0800
+++ Console/ConsoleView.cpp 2013-06-02 17:35:41.261442200 +0800
@@ -95,7 +95,12 @@
// This prevents WM_CHAR and WM_SYSCHAR messages, enabling stuff like
// handling 'dead' characters input and passing all keys to console.
if (pMsg->wParam == VK_PACKET) return FALSE;
- ::DispatchMessage(pMsg);
+ // chinese input begin
+ //::DispatchMessage(pMsg);
+ ::TranslateMessage(pMsg);
+ if(!::PeekMessage(pMsg, NULL, 0, 0, PM_NOREMOVE))
+ ::DispatchMessage(pMsg);
+ // chinese input end
return TRUE;
}
如果你不打算自行編譯的話, 也可以用我自行編譯的這個版本: http://www.teatime.com.tw/~tommy/files/console2_b148_chinese_input.7z
這是用 Visual Studio 2012 編譯出來的, 如果不能執行, 請自行裝上 2012 的 Redistributable Package. 對了, 裡頭包含 x86 與 x64 的版本.