diff --git a/sakura_core/dlg/CDialog.cpp b/sakura_core/dlg/CDialog.cpp index 7ec031ba25..ee7ac7fa69 100644 --- a/sakura_core/dlg/CDialog.cpp +++ b/sakura_core/dlg/CDialog.cpp @@ -808,8 +808,8 @@ LRESULT CALLBACK SubEditProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, void CDialog::SetComboBoxDeleter(HWND hwndCtl, CRecent* pRecent) { - assert(pRecent); - + if (!pRecent || (::GetWindowLongPtr(hwndCtl, GWL_STYLE) & 0b11) == CBS_DROPDOWNLIST) + return; COMBOBOXINFO info = { sizeof(COMBOBOXINFO) }; if (!::GetComboBoxInfo(hwndCtl, &info)) return; diff --git a/sakura_core/dlg/CDialog.h b/sakura_core/dlg/CDialog.h index 54df51a35d..a81d8fddbc 100644 --- a/sakura_core/dlg/CDialog.h +++ b/sakura_core/dlg/CDialog.h @@ -115,6 +115,11 @@ class CDialog void ResizeItem( HWND hTarget, const POINT& ptDlgDefalut, const POINT& ptDlgNew, const RECT& rcItemDefault, EAnchorStyle anchor, bool bUpdate = true); void GetItemClientRect( int wID, RECT& rc ); + + //! @brief コンボボックスに履歴削除・単語削除の機能を追加する + //! + //! @param hwndCtl コンボボックスのハンドル。CBS_DROPDOWNLISTスタイルのコンボボックスには対応していません。 + //! @param pRecent 紐づけるCRecentへのポインタ。nullptrは指定できません。 static void SetComboBoxDeleter( HWND hwndCtl, CRecent* pRecent ); public: diff --git a/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp b/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp index 2605579771..285255e562 100644 --- a/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp +++ b/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp @@ -370,9 +370,6 @@ UINT_PTR CALLBACK OFNHookProc( /* ビューモードの初期値セット */ ::CheckDlgButton( pData->m_hwndOpenDlg, chx1, pData->m_bViewMode ); - - CDialog::SetComboBoxDeleter(pData->m_hwndComboMRU, &pData->m_cRecentFile); - CDialog::SetComboBoxDeleter(pData->m_hwndComboOPENFOLDER, &pData->m_cRecentFolder); } break;