Revision: 7312 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7312 Author: zmatsuo Date: 2018-12-11 00:00:08 +0900 (Tue, 11 Dec 2018) Log Message: ----------- keycodeをunicode対応に修正 Modified Paths: -------------- branches/cmake/teraterm/keycode/CMakeLists.txt branches/cmake/teraterm/keycode/keycode.c -------------- next part -------------- Modified: branches/cmake/teraterm/keycode/CMakeLists.txt =================================================================== --- branches/cmake/teraterm/keycode/CMakeLists.txt 2018-12-10 14:59:54 UTC (rev 7311) +++ branches/cmake/teraterm/keycode/CMakeLists.txt 2018-12-10 15:00:08 UTC (rev 7312) @@ -11,6 +11,10 @@ string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) endif () +if(USE_UNICODE_API) + add_definitions(-DUNICODE -D_UNICODE) +endif() + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/") set(SRC Modified: branches/cmake/teraterm/keycode/keycode.c =================================================================== --- branches/cmake/teraterm/keycode/keycode.c 2018-12-10 14:59:54 UTC (rev 7311) +++ branches/cmake/teraterm/keycode/keycode.c 2018-12-10 15:00:08 UTC (rev 7312) @@ -1,6 +1,6 @@ /* * Copyright (C) 1994-1998 T. Teranishi - * (C) 2006-2017 TeraTerm Project + * (C) 2006-2018 TeraTerm Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,10 @@ #include <windows.h> #include <stdio.h> #include <string.h> +#include <tchar.h> #include "kc_res.h" -#define ClassName "KeyCodeWin32" +#define ClassName _T("KeyCodeWin32") #include "compat_w95.h" @@ -64,7 +65,7 @@ DoCover_IsDebuggerPresent(); - if ((module = GetModuleHandle("kernel32.dll")) != NULL) { + if ((module = GetModuleHandleA("kernel32.dll")) != NULL) { if ((setDefDllDir = (pSetDefDllDir)GetProcAddress(module, "SetDefaultDllDirectories")) != NULL) { // SetDefaultDllDirectories() \x82\xAA\x8Eg\x82\xA6\x82\xE9\x8Fꍇ\x82́A\x8C\x9F\x8D\xF5\x83p\x83X\x82\xF0 %WINDOWS%\system32 \x82݂̂ɐݒ肷\x82\xE9 (*setDefDllDir)((DWORD)0x00000800); // LOAD_LIBRARY_SEARCH_SYSTEM32 @@ -93,7 +94,7 @@ ghInstance = hInstance; hWnd = CreateWindow(ClassName, - "Key code for Tera Term", + _T("Key code for Tera Term"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, @@ -168,16 +169,16 @@ { PAINTSTRUCT ps; HDC hDC; - char OutStr[30]; + TCHAR OutStr[30]; hDC = BeginPaint(hWnd, &ps); if (KeyDown) { - _snprintf_s(OutStr,sizeof(OutStr),_TRUNCATE,"Key code is %u.",Scan); - TextOut(hDC,10,10,OutStr,strlen(OutStr)); + _sntprintf_s(OutStr,_countof(OutStr),_TRUNCATE, _T("Key code is %u.") ,Scan); + TextOut(hDC,10,10,OutStr,_tcslen(OutStr)); } else { - TextOut(hDC,10,10,"Push any key.",13); + TextOut(hDC,10,10,_T("Push any key."),13); } EndPaint(hWnd, &ps);