diff --git a/program/TWR/BaseDialog.cpp b/program/TWR/BaseDialog.cpp index 9194703..d614188 100644 --- a/program/TWR/BaseDialog.cpp +++ b/program/TWR/BaseDialog.cpp @@ -184,22 +184,22 @@ INT_PTR CALLBACK BaseDialog::dialogProc(HWND hDlg, UINT message, WPARAM wParam, case WM_INITDIALOG: this->hWnd = hDlg; result = OnInitDialog(); - return TRUE; + return (INT_PTR)TRUE; case WM_SHOWWINDOW: if (wParam == TRUE) { PostMessage(this->hWnd, WM_DIALOG_SHOWN, 0, 0); } - return TRUE; + return (INT_PTR)TRUE; case WM_DIALOG_SHOWN: result = OnWindowShown(wParam, lParam); PostMessage(this->hWnd, WM_DIALOG_CREATED, 0, 0); - return TRUE; + return (INT_PTR)TRUE; case WM_DIALOG_CREATED: result = OnWindowCreated(wParam, lParam); - return TRUE; + return (INT_PTR)TRUE; case WM_COMMAND: result = OnCommand(wParam); diff --git a/program/langresource.cpp b/program/langresource.cpp index 13a4f23..0d2c8f7 100644 --- a/program/langresource.cpp +++ b/program/langresource.cpp @@ -1,5 +1,5 @@ /* -noMeiryoUI (C) 2005,2012-2024 Tatsuhiko Shoji +noMeiryoUI (C) 2005,2012-2025 Tatsuhiko Shoji The sources for noMeiryoUI are distributed under the MIT open source license */ @@ -283,5 +283,11 @@ void readResourceFile(TCHAR *file) readResourceItem(file, _T("MENU_TOOLS_NO_MULTI_RUN"), _T("&Don't run multiply") ); + readResourceItem(file, _T("MENU_FORCE_TITLE_SET"), + _T("F&orce title bar font change enabled") + ); + readResourceItem(file, _T("MSG_FORCE_TITLE_SET"), + _T("Changeing titlebar font may cause some troubles.") + ); } diff --git a/program/langresource.h b/program/langresource.h index bca6467..d610666 100644 --- a/program/langresource.h +++ b/program/langresource.h @@ -1,5 +1,5 @@ /* -noMeiryoUI (C) 2005,2012-2024 Tatsuhiko Shoji +noMeiryoUI (C) 2005,2012-2025 Tatsuhiko Shoji The sources for noMeiryoUI are distributed under the MIT open source license */ @@ -96,6 +96,8 @@ The sources for noMeiryoUI are distributed under the MIT open source license #define MSG_WIN11_22H2RESTRICTION 85 #define MENU_CHOICE_APP_FONT 86 #define MENU_DONT_RUN_MULTIPLY 87 +#define MENU_FORCE_TITLE_SET 88 +#define MSG_FORCE_TITLE_SET 89 extern void readResourceFile(TCHAR *file); diff --git a/program/noMeiryoUI.cpp b/program/noMeiryoUI.cpp index fc93034..f34b96c 100644 --- a/program/noMeiryoUI.cpp +++ b/program/noMeiryoUI.cpp @@ -272,6 +272,7 @@ int NoMeiryoUI::OnAppliStart(TCHAR *lpCmdLine) usePreset = false; autosetDelay = 0; + forceTitleFontSet = false; loadConfig(); handleMultipleRun(); @@ -455,6 +456,8 @@ INT_PTR NoMeiryoUI::OnWindowShown(WPARAM wParam, LPARAM lParam) appMenu->setEnabled(IDM_SET_8, has8Preset); appMenu->setEnabled(IDM_SET_10, has10Preset); appMenu->setEnabled(IDM_SET_11, has11Preset); + + // 複数起動設定 if (!multiRun) { appMenu->CheckMenuItem(IDM_NO_MULTI_RUN, true); } @@ -516,7 +519,7 @@ INT_PTR NoMeiryoUI::OnWindowShown(WPARAM wParam, LPARAM lParam) } /** - * WM_SHOWWINDOWメッセージによる表示状態変更時の処理 + * ダイアログが表示された後に行う処理 * * @param wParam WPARAM * @param lParam lParam @@ -528,13 +531,15 @@ INT_PTR NoMeiryoUI::OnWindowCreated(WPARAM wParam, LPARAM lParam) if (compatLevel > 0) { titleFontButton->EnableWindow(FALSE); + appMenu->setEnabled(IDM_FORCE_TITLE_SET, true); // ワーニングメッセージ in Win11 22H2 MessageBox(this->getHwnd(), langResource[MSG_WIN11_22H2RESTRICTION].c_str(), langResource[MSG_WARNING].c_str(), MB_OK | MB_ICONWARNING); //MessageBox(this->getHwnd(), _T("Windows 11のバカヤロー"), // _T("何じゃぁこりゃぁ"), MB_OK | MB_ICONWARNING); - + } else { + appMenu->setEnabled(IDM_FORCE_TITLE_SET, false); } return (INT_PTR)0; @@ -877,6 +882,7 @@ void NoMeiryoUI::applyDisplayText() appMenu->setText(2, langResource[10].c_str(), TRUE); appMenu->setText(IDM_CHOICE_APP_FONT, langResource[MENU_CHOICE_APP_FONT].c_str(), FALSE); appMenu->setText(IDM_NO_MULTI_RUN, langResource[MENU_DONT_RUN_MULTIPLY].c_str(), FALSE); + appMenu->setText(IDM_FORCE_TITLE_SET, langResource[MENU_FORCE_TITLE_SET].c_str(), FALSE); appMenu->setText(IDM_ANOTHER, langResource[MENU_TOOLS_THREAD].c_str(), FALSE); appMenu->setText(IDM_COMPAT7, langResource[MENU_TOOLS_SEVEN].c_str(), FALSE); appMenu->setText(3, langResource[13].c_str(), TRUE); @@ -1202,6 +1208,9 @@ INT_PTR NoMeiryoUI::OnCommand(WPARAM wParam) case IDM_NO_MULTI_RUN: toggleMultiRun(); + return (INT_PTR)0; + case IDM_FORCE_TITLE_SET: + toggleForceTitleSet(); return (INT_PTR)0; case IDM_HELPTOPIC: showHelp(); @@ -1247,6 +1256,30 @@ void NoMeiryoUI::toggleMultiRun() saveConfig(); } +/** + * @brief Windows 11 22H2以降での強制フォント設定切り替え + */ +void NoMeiryoUI::toggleForceTitleSet() +{ + if (appMenu->isChecked(IDM_FORCE_TITLE_SET)) { + appMenu->CheckMenuItem(IDM_FORCE_TITLE_SET, false); + forceTitleFontSet = false; + if (compatLevel > 0) { + titleFontButton->EnableWindow(FALSE); + } + } else { + appMenu->CheckMenuItem(IDM_FORCE_TITLE_SET, true); + forceTitleFontSet = true; + if (compatLevel > 0) { + titleFontButton->EnableWindow(TRUE); + MessageBox(this->getHwnd(), langResource[MSG_FORCE_TITLE_SET].c_str(), + langResource[MSG_WARNING].c_str(), MB_OK | MB_ICONWARNING); + } + } +} + + + /** * フォントを選択する。 * @@ -1361,7 +1394,7 @@ void NoMeiryoUI::selectFont(enum fontType type) case title: // Silently ignore on Win11 22H2 - if (compatLevel < 1) { + if ((compatLevel < 1) || (forceTitleFontSet)) { metrics.lfCaptionFont = logfont; titleFontName = logfont.lfFaceName; diff --git a/program/noMeiryoUI.h b/program/noMeiryoUI.h index 2402f2e..402f2c3 100644 --- a/program/noMeiryoUI.h +++ b/program/noMeiryoUI.h @@ -116,6 +116,7 @@ private: bool firstShow; int autosetDelay; + bool forceTitleFontSet; void OnLoad(); BOOL loadFontInfo(TCHAR *filename); @@ -162,6 +163,8 @@ private: protected: INT_PTR OnCommand(WPARAM wParam); + void toggleForceTitleSet(); + public: BaseDialog *createBaseDialog(); diff --git a/program/noMeiryoUI.rc b/program/noMeiryoUI.rc index 62ee16c..856d953 100644 --- a/program/noMeiryoUI.rc +++ b/program/noMeiryoUI.rc @@ -247,6 +247,7 @@ BEGIN MENUITEM "別スレッドでフォントを変更する(&A)", IDM_ANOTHER MENUITEM "フォントサイズをWindows 7と同様に扱う(&7)", IDM_COMPAT7 MENUITEM "二重起動をしない(&D)", IDM_NO_MULTI_RUN + MENUITEM "タイトルバーのフォントを変更可能にする(&O)", IDM_FORCE_TITLE_SET END POPUP "ヘルプ(&H)" BEGIN diff --git a/program/resource.h b/program/resource.h index bd685b0..034789f 100644 --- a/program/resource.h +++ b/program/resource.h @@ -81,6 +81,8 @@ #define IDM_SET_11 32792 #define IDM_NO_MULTI_RUN 32793 #define IDM_CHOICE_APP_FONT 32794 +#define ID_32795 32795 +#define IDM_FORCE_TITLE_SET 32796 #define IDC_STATIC -1 #define IDC_STATIC_CHARSET -1 #define IDC_GROUP_INDIVIDUAL -1 @@ -91,7 +93,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 134 -#define _APS_NEXT_COMMAND_VALUE 32795 +#define _APS_NEXT_COMMAND_VALUE 32797 #define _APS_NEXT_CONTROL_VALUE 1024 #define _APS_NEXT_SYMED_VALUE 110 #endif