Revision: 9319 https://osdn.net/projects/ttssh2/scm/svn/commits/9319 Author: zmatsuo Date: 2021-06-30 00:19:33 +0900 (Wed, 30 Jun 2021) Log Message: ----------- _HtmlHelpW() を layer_for_unicode.cpp から compat_win.cpp へ移動 - 起動時に HtmlHelp(...INITIALIZE ) がコールされていなかった - r8582 Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/8582 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 trunk/teraterm/teraterm/teraterm.cpp -------------- next part -------------- Modified: trunk/teraterm/common/compat_win.cpp =================================================================== --- trunk/teraterm/common/compat_win.cpp 2021-06-29 15:19:25 UTC (rev 9318) +++ trunk/teraterm/common/compat_win.cpp 2021-06-29 15:19:33 UTC (rev 9319) @@ -36,6 +36,7 @@ #include "dllutil.h" #include "ttlib.h" +#include "codeconv.h" // for debug //#define UNICODE_API_DISABLE 1 @@ -110,9 +111,9 @@ int (WINAPI *pAddFontResourceExW)(LPCWSTR name, DWORD fl, PVOID res); BOOL (WINAPI *pRemoveFontResourceExW)(LPCWSTR name, DWORD fl, PVOID pdv); -// htmlhelp.ocx -HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); -HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData); +// htmlhelp.dll (hhctrl.ocx) +static HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); +static HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData); BOOL (WINAPI *pInsertMenuW)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); BOOL (WINAPI *pAppendMenuW)(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); @@ -383,3 +384,20 @@ pGetConsoleWindow = GetConsoleWindowLocal; } } + +HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData) +{ + if (pHtmlHelpW != NULL) { + return pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData); + } + + if (pHtmlHelpA != NULL) { + char *fileA = ToCharW(pszFile); + HWND r = pHtmlHelpA(hwndCaller, fileA, uCommand, dwData); + free(fileA); + return r; + } + + // error + return NULL; +} Modified: trunk/teraterm/common/compat_win.h =================================================================== --- trunk/teraterm/common/compat_win.h 2021-06-29 15:19:25 UTC (rev 9318) +++ trunk/teraterm/common/compat_win.h 2021-06-29 15:19:33 UTC (rev 9319) @@ -99,8 +99,6 @@ extern HWND (WINAPI *pCreateDialogIndirectParamW)(HINSTANCE hInstance, LPCDLGTEMPLATEW lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam); -extern HWND (WINAPI *pHtmlHelpW)(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); -extern HWND (WINAPI *pHtmlHelpA)(HWND hwndCaller, LPCSTR pszFile, UINT uCommand, DWORD_PTR dwData); extern BOOL (WINAPI *pInsertMenuW)(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); extern BOOL (WINAPI *pAppendMenuW)(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); extern HMONITOR (WINAPI *pMonitorFromWindow)(HWND hwnd, DWORD dwFlags); @@ -166,6 +164,9 @@ extern LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW lpbi); extern BOOL (WINAPI *pSHGetPathFromIDListW)(LPITEMIDLIST pidl, LPWSTR pszPath); +// htmlhelp.dll (hhctrl.ocx) +HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); + void WinCompatInit(); #ifdef __cplusplus Modified: trunk/teraterm/common/layer_for_unicode.cpp =================================================================== --- trunk/teraterm/common/layer_for_unicode.cpp 2021-06-29 15:19:25 UTC (rev 9318) +++ trunk/teraterm/common/layer_for_unicode.cpp 2021-06-29 15:19:33 UTC (rev 9319) @@ -406,20 +406,6 @@ return result; } -HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData) -{ - if (pHtmlHelpW != NULL) { - return pHtmlHelpW(hwndCaller, pszFile, uCommand, dwData); - } - if (pHtmlHelpA != NULL) { - char *fileA = ToCharW(pszFile); - HWND result = pHtmlHelpA(hwndCaller, fileA, uCommand, dwData); - free(fileA); - return result; - } - return NULL; -} - BOOL _AppendMenuW(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem) { if (pAppendMenuW != NULL) { Modified: trunk/teraterm/common/layer_for_unicode.h =================================================================== --- trunk/teraterm/common/layer_for_unicode.h 2021-06-29 15:19:25 UTC (rev 9318) +++ trunk/teraterm/common/layer_for_unicode.h 2021-06-29 15:19:33 UTC (rev 9319) @@ -106,7 +106,6 @@ int _MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); BOOL _InsertMenuW(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); BOOL _AppendMenuW(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem); -HWND _HtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_PTR dwData); int _GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount); int _GetWindowTextLengthW(HWND hWnd); LONG_PTR _SetWindowLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong); Modified: trunk/teraterm/teraterm/teraterm.cpp =================================================================== --- trunk/teraterm/teraterm/teraterm.cpp 2021-06-29 15:19:25 UTC (rev 9318) +++ trunk/teraterm/teraterm/teraterm.cpp 2021-06-29 15:19:33 UTC (rev 9319) @@ -284,8 +284,8 @@ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif + init(); _HtmlHelpW(NULL, NULL, HH_INITIALIZE, (DWORD_PTR)&HtmlHelpCookie); - init(); hInst = hInstance; CVTWindow *m_pMainWnd = new CVTWindow(hInstance); pVTWin = m_pMainWnd;