diff --git a/src/MAddBitmapDlg.hpp b/src/MAddBitmapDlg.hpp index d8d5fce4..9c6a2417 100644 --- a/src/MAddBitmapDlg.hpp +++ b/src/MAddBitmapDlg.hpp @@ -112,6 +112,16 @@ class MAddBitmapDlg : public MDialogBase if (GetOpenFileNameW(&ofn)) { SetDlgItemTextW(hwnd, edt1, szFile); + + // If name was empty, use file title + WCHAR szText[MAX_PATH]; + ComboBox_GetText(GetDlgItem(hwnd, cmb2), szText, _countof(szText)); + if (!szText[0]) + { + StringCchCopyW(szText, _countof(szText), szFile); + PathRemoveExtensionW(szText); + ComboBox_SetText(GetDlgItem(hwnd, cmb2), PathFindFileNameW(szText)); + } } } diff --git a/src/MAddCursorDlg.hpp b/src/MAddCursorDlg.hpp index aefdd851..328d06cc 100644 --- a/src/MAddCursorDlg.hpp +++ b/src/MAddCursorDlg.hpp @@ -202,6 +202,16 @@ class MAddCursorDlg : public MDialogBase DestroyCursor(m_hCursor); m_hCursor = LoadCursorFromFile(szFile); SendDlgItemMessage(hwnd, ico1, STM_SETIMAGE, IMAGE_CURSOR, LPARAM(m_hCursor)); + + // If name was empty, use file title + WCHAR szText[MAX_PATH]; + ComboBox_GetText(GetDlgItem(hwnd, cmb2), szText, _countof(szText)); + if (!szText[0]) + { + StringCchCopyW(szText, _countof(szText), szFile); + PathRemoveExtensionW(szText); + ComboBox_SetText(GetDlgItem(hwnd, cmb2), PathFindFileNameW(szText)); + } } } diff --git a/src/MAddIconDlg.hpp b/src/MAddIconDlg.hpp index 9554eee7..2c79d3d8 100644 --- a/src/MAddIconDlg.hpp +++ b/src/MAddIconDlg.hpp @@ -185,6 +185,16 @@ class MAddIconDlg : public MDialogBase DestroyIcon(m_hIcon); m_hIcon = ExtractIcon(GetModuleHandle(NULL), szFile, 0); Static_SetIcon(GetDlgItem(hwnd, ico1), m_hIcon); + + // If name was empty, use file title + WCHAR szText[MAX_PATH]; + ComboBox_GetText(GetDlgItem(hwnd, cmb2), szText, _countof(szText)); + if (!szText[0]) + { + StringCchCopyW(szText, _countof(szText), szFile); + PathRemoveExtensionW(szText); + ComboBox_SetText(GetDlgItem(hwnd, cmb2), PathFindFileNameW(szText)); + } } } diff --git a/src/MAddResDlg.hpp b/src/MAddResDlg.hpp index ebb46153..f673af32 100644 --- a/src/MAddResDlg.hpp +++ b/src/MAddResDlg.hpp @@ -311,6 +311,16 @@ class MAddResDlg : public MDialogBase { // set the file path SetDlgItemTextW(hwnd, edt1, szFile); + + // If name was empty, use file title + WCHAR szText[MAX_PATH]; + ComboBox_GetText(GetDlgItem(hwnd, cmb2), szText, _countof(szText)); + if (!szText[0]) + { + StringCchCopyW(szText, _countof(szText), szFile); + PathRemoveExtensionW(szText); + ComboBox_SetText(GetDlgItem(hwnd, cmb2), PathFindFileNameW(szText)); + } } } @@ -396,6 +406,7 @@ class MAddResDlg : public MDialogBase return; // prefix --> m_cmb2 + ComboBox_GetText(m_cmb2, szText, _countof(szText)); ComboBox_ResetContent(m_cmb2); if (type != RT_STRING && type != RT_MESSAGETABLE) { @@ -405,6 +416,7 @@ class MAddResDlg : public MDialogBase ComboBox_AddString(m_cmb2, table_entry.name.c_str()); } } + ComboBox_SetText(m_cmb2, szText); } void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)