Revision: 8687 https://osdn.net/projects/ttssh2/scm/svn/commits/8687 Author: zmatsuo Date: 2020-04-12 00:53:47 +0900 (Sun, 12 Apr 2020) Log Message: ----------- CInpDlg を unicode化 Modified Paths: -------------- trunk/teraterm/ttpmacro/inpdlg.cpp trunk/teraterm/ttpmacro/inpdlg.h trunk/teraterm/ttpmacro/ttl_gui.cpp trunk/teraterm/ttpmacro/ttmbuff.c trunk/teraterm/ttpmacro/ttmdlg.cpp trunk/teraterm/ttpmacro/ttmdlg.h -------------- next part -------------- Modified: trunk/teraterm/ttpmacro/inpdlg.cpp =================================================================== --- trunk/teraterm/ttpmacro/inpdlg.cpp 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/inpdlg.cpp 2020-04-11 15:53:47 UTC (rev 8687) @@ -40,8 +40,8 @@ #include "inpdlg.h" // CInpDlg dialog -CInpDlg::CInpDlg(TCHAR *Input, const TCHAR *Text, const TCHAR *Title, - const TCHAR *Default, BOOL Paswd, +CInpDlg::CInpDlg(wchar_t *Input, const wchar_t *Text, const wchar_t *Title, + const wchar_t *Default, BOOL Paswd, int x, int y) { InputStr = Input; @@ -68,11 +68,11 @@ HWND HEdit, HOk; SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile); - SetWindowText(TitleStr); - SetDlgItemText(IDC_INPTEXT,TextStr); - SetDlgItemText(IDC_INPEDIT,DefaultStr); + SetWindowTextW(TitleStr); + SetDlgItemTextW(IDC_INPTEXT,TextStr); + SetDlgItemTextW(IDC_INPEDIT,DefaultStr); - CalcTextExtent(GetDlgItem(IDC_INPTEXT), NULL, TextStr, &s); + CalcTextExtentW(GetDlgItem(IDC_INPTEXT), NULL, TextStr, &s); TW = s.cx + s.cx/10; TH = s.cy; @@ -99,7 +99,7 @@ BOOL CInpDlg::OnOK() { - GetDlgItemText(IDC_INPEDIT,InputStr,MaxStrLen-1); + GetDlgItemTextW(IDC_INPEDIT,InputStr,MaxStrLen-1); EndDialog(IDOK); return TRUE; } Modified: trunk/teraterm/ttpmacro/inpdlg.h =================================================================== --- trunk/teraterm/ttpmacro/inpdlg.h 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/inpdlg.h 2020-04-11 15:53:47 UTC (rev 8687) @@ -1,6 +1,6 @@ /* * Copyright (C) 1994-1998 T. Teranishi - * (C) 2006-2019 TeraTerm Project + * (C) 2006-2020 TeraTerm Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,8 +37,8 @@ class CInpDlg : public CMacroDlgBase { public: - CInpDlg(TCHAR *Input, const TCHAR *Text, const TCHAR *Title, - const TCHAR *Default, BOOL Paswd, + CInpDlg(wchar_t *Input, const wchar_t *Text, const wchar_t *Title, + const wchar_t *Default, BOOL Paswd, int x, int y); INT_PTR DoModal(HINSTANCE hInst, HWND hWndParent); @@ -45,10 +45,10 @@ private: enum { IDD = IDD_INPDLG }; - TCHAR *InputStr; - const TCHAR *TextStr; - const TCHAR *TitleStr; - const TCHAR *DefaultStr; + wchar_t *InputStr; + const wchar_t *TextStr; + const wchar_t *TitleStr; + const wchar_t *DefaultStr; BOOL PaswdFlag; int init_WW, TW, TH, BH, BW, EW, EH; SIZE s; Modified: trunk/teraterm/ttpmacro/ttl_gui.cpp =================================================================== --- trunk/teraterm/ttpmacro/ttl_gui.cpp 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/ttl_gui.cpp 2020-04-11 15:53:47 UTC (rev 8687) @@ -321,14 +321,10 @@ Temp,_countof(Temp), tc::fromUtf8(Str)); if (Temp[0]==0) // password not exist { -#if defined(UNICODE) - TCHAR input_string[MaxStrLen]; + wchar_t input_string[MaxStrLen]; size_t Temp2_len = sizeof(Temp2); - OpenInpDlg(input_string, tc::fromUtf8(Str2), _T("Enter password"), _T(""), TRUE); + OpenInpDlg(input_string, wc::fromUtf8(Str2), L"Enter password", L"", TRUE); WideCharToUTF8(input_string, NULL, Temp2, &Temp2_len); -#else - OpenInpDlg(Temp2, Str2, _T("Enter password"), _T(""), TRUE); -#endif if (Temp2[0]!=0) { char TempA[512]; Encrypt(Temp2, TempA); @@ -390,15 +386,11 @@ SetInputStr(""); if (CheckVar("inputstr",&ValType,&VarId) && (ValType==TypString)) { -#if defined(UNICODE) - TCHAR input_string[MaxStrLen]; - OpenInpDlg(input_string,tc::fromUtf8(Str1),tc::fromUtf8(Str2),tc::fromUtf8(Str3),Paswd); + wchar_t input_string[MaxStrLen]; + OpenInpDlg(input_string,wc::fromUtf8(Str1),wc::fromUtf8(Str2),wc::fromUtf8(Str3),Paswd); char *output = StrVarPtr(VarId); size_t str_len = MaxStrLen; WideCharToUTF8(input_string, NULL, output, &str_len); -#else - OpenInpDlg(StrVarPtr(VarId),Str1,Str2,Str3,Paswd); -#endif } return Err; } Modified: trunk/teraterm/ttpmacro/ttmbuff.c =================================================================== --- trunk/teraterm/ttpmacro/ttmbuff.c 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/ttmbuff.c 2020-04-11 15:53:47 UTC (rev 8687) @@ -1,6 +1,6 @@ /* * Copyright (C) 1994-1998 T. Teranishi - * (C) 2005-2017 TeraTerm Project + * (C) 2005-2020 TeraTerm Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -140,8 +140,8 @@ BuffPtr[IBuff] = 0; - Buff[IBuff] = LoadFileAA(FileName, &Len); -// Buff[IBuff] = LoadFileU8A(FileName, &Len); +// Buff[IBuff] = LoadFileAA(FileName, &Len); + Buff[IBuff] = LoadFileU8A(FileName, &Len); if (Buff[IBuff] == NULL) { BuffLen[IBuff] = 0; return FALSE; Modified: trunk/teraterm/ttpmacro/ttmdlg.cpp =================================================================== --- trunk/teraterm/ttpmacro/ttmdlg.cpp 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/ttmdlg.cpp 2020-04-11 15:53:47 UTC (rev 8687) @@ -221,8 +221,8 @@ } } -void OpenInpDlg(TCHAR *Buff, const TCHAR *Text, const TCHAR *Caption, - const TCHAR *Default, BOOL Paswd) +void OpenInpDlg(wchar_t *Buff, const wchar_t *Text, const wchar_t *Caption, + const wchar_t *Default, BOOL Paswd) { HINSTANCE hInst = GetInstance(); HWND hWndParent = GetHWND(); Modified: trunk/teraterm/ttpmacro/ttmdlg.h =================================================================== --- trunk/teraterm/ttpmacro/ttmdlg.h 2020-04-11 15:53:38 UTC (rev 8686) +++ trunk/teraterm/ttpmacro/ttmdlg.h 2020-04-11 15:53:47 UTC (rev 8687) @@ -40,8 +40,8 @@ void ParseParam(PBOOL IOption, PBOOL VOption); BOOL GetFileName(HWND HWin); void SetDlgPos(int x, int y); -void OpenInpDlg(TCHAR *Input, const TCHAR *Text, const TCHAR *Caption, - const TCHAR *Default, BOOL Paswd); +void OpenInpDlg(wchar_t *Input, const wchar_t *Text, const wchar_t *Caption, + const wchar_t *Default, BOOL Paswd); int OpenErrDlg(const char *Msg, const char *Line, int lineno, int start, int end, const char *FileName); int OpenMsgDlg(const wchar_t *Text, const wchar_t *Caption, BOOL YesNo); void OpenStatDlg(const TCHAR *Text, const TCHAR *Caption);