[Ttssh2-commit] [9141] _GetWindowLongPtrW() を追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 1月 30日 (土) 00:35:07 JST


Revision: 9141
          https://osdn.net/projects/ttssh2/scm/svn/commits/9141
Author:   zmatsuo
Date:     2021-01-30 00:35:06 +0900 (Sat, 30 Jan 2021)
Log Message:
-----------
_GetWindowLongPtrW() を追加

- 32bit用ビルドの場合は内部で _GetWindowLongW() を呼び出す
  - _SetWindowLongPtrW() と同様
  - 利用側は _GetWindowLongPtrW() を利用すれば適切に処理される
    - GetWindowLongPtrW(), SetWindowLongPtrW() と同様

Modified Paths:
--------------
    trunk/teraterm/common/compat_win.cpp
    trunk/teraterm/common/compat_win.h
    trunk/teraterm/common/layer_for_unicode.cpp
    trunk/teraterm/common/layer_for_unicode.h

-------------- next part --------------
Modified: trunk/teraterm/common/compat_win.cpp
===================================================================
--- trunk/teraterm/common/compat_win.cpp	2021-01-27 14:53:16 UTC (rev 9140)
+++ trunk/teraterm/common/compat_win.cpp	2021-01-29 15:35:06 UTC (rev 9141)
@@ -66,8 +66,10 @@
 										   HWND hWndParent, DLGPROC lpDialogFunc,
 										   LPARAM dwInitParam);
 LONG (WINAPI *pSetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong);
+LONG (WINAPI *pGetWindowLongW)(HWND hWnd, int nIndex);
 #ifdef _WIN64
 LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
+LONG_PTR (WINAPI *pGetWindowLongPtrW)(HWND hWnd, int nIndex);
 #endif
 LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
 DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD nBufferLength, LPWSTR lpBuffer);
@@ -208,8 +210,10 @@
 	{ "GetWindowTextW", (void **)&pGetWindowTextW },
 	{ "GetWindowTextLengthW", (void **)&pGetWindowTextLengthW },
 	{ "SetWindowLongW", (void **)&pSetWindowLongW },
+	{ "GetWindowLongW", (void **)&pGetWindowLongW },
 #ifdef _WIN64
 	{ "SetWindowLongPtrW", (void **)&pSetWindowLongPtrW },
+	{ "GetWindowLongPtrW", (void **)&pGetWindowLongPtrW },
 #endif
 	{ "CallWindowProcW", (void **)&pCallWindowProcW },
 #endif

Modified: trunk/teraterm/common/compat_win.h
===================================================================
--- trunk/teraterm/common/compat_win.h	2021-01-27 14:53:16 UTC (rev 9140)
+++ trunk/teraterm/common/compat_win.h	2021-01-29 15:35:06 UTC (rev 9141)
@@ -114,8 +114,10 @@
 extern int (WINAPI *pGetWindowTextLengthW)(HWND hWnd);
 extern BOOL (WINAPI *pShell_NotifyIconW)(DWORD dwMessage, NOTIFYICONDATAW *lpData);
 extern LONG (WINAPI *pSetWindowLongW)(HWND hWnd, int nIndex, LONG dwNewLong);
+extern LONG (WINAPI *pGetWindowLongW)(HWND hWnd, int nIndex);
 #ifdef _WIN64
 extern LONG_PTR (WINAPI *pSetWindowLongPtrW)(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
+extern LONG_PTR (WINAPI *pGetWindowLongPtrW)(HWND hWnd, int nIndex);
 #endif
 extern LRESULT (WINAPI *pCallWindowProcW)(WNDPROC lpPrevWndFunc,
 										  HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

Modified: trunk/teraterm/common/layer_for_unicode.cpp
===================================================================
--- trunk/teraterm/common/layer_for_unicode.cpp	2021-01-27 14:53:16 UTC (rev 9140)
+++ trunk/teraterm/common/layer_for_unicode.cpp	2021-01-29 15:35:06 UTC (rev 9141)
@@ -544,6 +544,26 @@
 #endif
 }
 
+LONG _GetWindowLongW(HWND hWnd, int nIndex)
+{
+	if (pGetWindowLongW != NULL) {
+		return pGetWindowLongW(hWnd, nIndex);
+	}
+	return GetWindowLongA(hWnd, nIndex);
+}
+
+LONG_PTR _GetWindowLongPtrW(HWND hWnd, int nIndex)
+{
+#ifdef _WIN64
+	if (pGetWindowLongPtrW != NULL) {
+		return pGetWindowLongPtrW(hWnd, nIndex);
+	}
+	return GetWindowLongPtrA(hWnd, nIndex);
+#else
+	return _GetWindowLongW(hWnd, nIndex);
+#endif
+}
+
 LRESULT _CallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
 	if (pCallWindowProcW != NULL) {

Modified: trunk/teraterm/common/layer_for_unicode.h
===================================================================
--- trunk/teraterm/common/layer_for_unicode.h	2021-01-27 14:53:16 UTC (rev 9140)
+++ trunk/teraterm/common/layer_for_unicode.h	2021-01-29 15:35:06 UTC (rev 9141)
@@ -110,6 +110,7 @@
 int _GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount);
 int _GetWindowTextLengthW(HWND hWnd);
 LONG_PTR _SetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
+LONG_PTR _GetWindowLongPtrW(HWND hWnd, int nIndex);
 LRESULT _CallWindowProcW(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
 
 // kernel32.dll


Ttssh2-commit メーリングリストの案内
Back to archive index