Index: dialog.c =================================================================== --- dialog.c (revision 50573) +++ dialog.c (working copy) @@ -112,32 +112,40 @@ /** * Sets the caption of the main window according to Globals.szFileTitle: - * Notepad - (untitled) if no file is open - * Notepad - [filename] if a file is given + * (untitled) - Notepad if no file is open + * [filename] - Notepad if a file is given + * "(untitled) - Notepad" instead of "Notepad - (untitled)" by Edijus */ static void UpdateWindowCaption(void) { TCHAR szCaption[MAX_STRING_LEN]; + TCHAR TempCaption[MAX_STRING_LEN]; TCHAR szUntitled[MAX_STRING_LEN]; + TCHAR szFileExt[MAX_STRING_LEN]; LoadString(Globals.hInstance, STRING_NOTEPAD, szCaption, SIZEOF(szCaption)); - if (Globals.szFileTitle[0] != '\0') { - static const TCHAR bracket_l[] = _T(" - ["); - static const TCHAR bracket_r[] = _T("]"); - _tcscat(szCaption, bracket_l); - _tcscat(szCaption, Globals.szFileTitle); - _tcscat(szCaption, bracket_r); + if (Globals.szFileTitle[0] != '\0') + { + static const TCHAR hyphen[] = _T(" - "); + TempCaption[0] = '\0'; /*Clear*/ + szFileExt[0] = '\0'; + _tcscat(TempCaption, Globals.szFileTitle); + /*Finds file extension*/ + wchar_t* extension = wcsrchr(Globals.szFileName,'.'); + _tcscat(TempCaption,extension); + _tcscat(TempCaption, hyphen); + _tcscat(TempCaption, szCaption); + SetWindowText(Globals.hMainWnd, TempCaption); } else { static const TCHAR hyphen[] = _T(" - "); LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled)); - _tcscat(szCaption, hyphen); - _tcscat(szCaption, szUntitled); + _tcscat(szUntitled, hyphen); + _tcscat(szUntitled, szCaption); + SetWindowText(Globals.hMainWnd, szUntitled); } - - SetWindowText(Globals.hMainWnd, szCaption); } static void AlertFileNotFound(LPCTSTR szFileName)