[Ttssh2-commit] [8248] _SendDlgItemMessageW()を追加

scmno****@osdn***** scmno****@osdn*****
2019年 10月 3日 (木) 00:07:34 JST


Revision: 8248
          https://osdn.net/projects/ttssh2/scm/svn/commits/8248
Author:   zmatsuo
Date:     2019-10-03 00:07:34 +0900 (Thu, 03 Oct 2019)
Log Message:
-----------
_SendDlgItemMessageW()を追加

- SendDlgItemMessageW() の layer for uncode版

Modified Paths:
--------------
    branches/unicode_buf/teraterm/common/compat_win.cpp
    branches/unicode_buf/teraterm/common/compat_win.h
    branches/unicode_buf/teraterm/common/layer_for_unicode.cpp
    branches/unicode_buf/teraterm/common/layer_for_unicode.h
    branches/unicode_buf/teraterm/common/tmfc.cpp
    branches/unicode_buf/teraterm/ttpmacro/CMakeLists.txt

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/common/compat_win.cpp
===================================================================
--- branches/unicode_buf/teraterm/common/compat_win.cpp	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/common/compat_win.cpp	2019-10-02 15:07:34 UTC (rev 8248)
@@ -34,6 +34,7 @@
 
 #include "dllutil.h"
 
+LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
 BOOL (WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem);
 BOOL (WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString);
 DWORD (WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName);
@@ -64,6 +65,7 @@
 	{ "SetDlgItemTextW", (void **)&pSetDlgItemTextW },
 	{ "SetWindowTextW", (void **)&pSetWindowTextW },
 	{ "ModifyMenuW", (void **)&pModifyMenuW },
+	{ "SendDlgItemMessageW", (void **)&pSendDlgItemMessageW },
 	{ NULL, NULL },
 };
 

Modified: branches/unicode_buf/teraterm/common/compat_win.h
===================================================================
--- branches/unicode_buf/teraterm/common/compat_win.h	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/common/compat_win.h	2019-10-02 15:07:34 UTC (rev 8248)
@@ -67,6 +67,7 @@
 #define OPENFILENAME_SIZE_VERSION_400A	76
 #endif
 
+extern LRESULT (WINAPI *pSendDlgItemMessageW)(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
 extern BOOL(WINAPI *pModifyMenuW)(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem);
 extern BOOL(WINAPI *pSetWindowTextW)(HWND hWnd, LPCWSTR lpString);
 extern DWORD(WINAPI *pGetPrivateProfileStringW)(LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault,

Modified: branches/unicode_buf/teraterm/common/layer_for_unicode.cpp
===================================================================
--- branches/unicode_buf/teraterm/common/layer_for_unicode.cpp	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/common/layer_for_unicode.cpp	2019-10-02 15:07:34 UTC (rev 8248)
@@ -54,7 +54,7 @@
 UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch)
 {
 	if (pDragQueryFileW != NULL) {
-		return DragQueryFileW(hDrop, iFile, lpszFile, cch);
+		return pDragQueryFileW(hDrop, iFile, lpszFile, cch);
 	}
 
 	UINT retval;
@@ -88,7 +88,7 @@
 DWORD _GetFileAttributesW(LPCWSTR lpFileName)
 {
 	if (pGetFileAttributesW != NULL) {
-		return GetFileAttributesW(lpFileName);
+		return pGetFileAttributesW(lpFileName);
 	}
 
 	char *FileNameA;
@@ -101,3 +101,20 @@
 	free(FileNameA);
 	return attr;
 }
+
+LRESULT _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+	if (pSendDlgItemMessageW != NULL) {
+		return pSendDlgItemMessageW(hDlg, nIDDlgItem, Msg, wParam, lParam);
+	}
+
+	LRESULT retval;
+	if (Msg == CB_ADDSTRING || Msg == LB_ADDSTRING) {
+		char *strA = ToCharW((wchar_t *)lParam);
+		retval = SendDlgItemMessageA(hDlg, nIDDlgItem, Msg, wParam, (LPARAM)strA);
+		free(strA);
+	} else {
+		retval = SendDlgItemMessageA(hDlg, nIDDlgItem, Msg, wParam, lParam);
+	}
+	return retval;
+}

Modified: branches/unicode_buf/teraterm/common/layer_for_unicode.h
===================================================================
--- branches/unicode_buf/teraterm/common/layer_for_unicode.h	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/common/layer_for_unicode.h	2019-10-02 15:07:34 UTC (rev 8248)
@@ -43,6 +43,7 @@
 BOOL _SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString);
 DWORD _GetFileAttributesW(LPCWSTR lpFileName);
 UINT _DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch);
+LRESULT _SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam);
 
 #ifdef __cplusplus
 }

Modified: branches/unicode_buf/teraterm/common/tmfc.cpp
===================================================================
--- branches/unicode_buf/teraterm/common/tmfc.cpp	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/common/tmfc.cpp	2019-10-02 15:07:34 UTC (rev 8248)
@@ -36,6 +36,7 @@
 #include <tchar.h>
 #include "dlglib.h"
 #include "ttlib.h"
+#include "layer_for_unicode.h"
 
 // \x83e\x83\x93\x83v\x83\x8C\x81[\x83g\x82̏\x91\x82\xAB\x8A\xB7\x82\xA6\x82\xF0\x8Ds\x82\xA4
 #define REWRITE_TEMPLATE
@@ -70,7 +71,7 @@
 
 LRESULT TTCWnd::SendDlgItemMessageW(int id, UINT msg, WPARAM wp, LPARAM lp)
 {
-	return ::SendDlgItemMessageW(m_hWnd, id, msg, wp, lp);
+	return ::_SendDlgItemMessageW(m_hWnd, id, msg, wp, lp);
 }
 
 LRESULT TTCWnd::SendDlgItemMessageA(int id, UINT msg, WPARAM wp, LPARAM lp)

Modified: branches/unicode_buf/teraterm/ttpmacro/CMakeLists.txt
===================================================================
--- branches/unicode_buf/teraterm/ttpmacro/CMakeLists.txt	2019-10-02 15:07:20 UTC (rev 8247)
+++ branches/unicode_buf/teraterm/ttpmacro/CMakeLists.txt	2019-10-02 15:07:34 UTC (rev 8248)
@@ -33,7 +33,10 @@
   ../common/win16api.c
   ../common/codeconv.h
   ../common/codeconv.cpp
+  ../common/dllutil.h
   ../common/dllutil.cpp
+  ../common/layer_for_unicode.h
+  ../common/layer_for_unicode.cpp
   )
 
 source_group(


Ttssh2-commit メーリングリストの案内