notepad: Change window title to be like Windows' notepad.exe.
This commit is contained in:
parent
cc318be209
commit
3ec165fd99
|
@ -108,7 +108,7 @@ STRING_ERROR, "ERROR"
|
||||||
STRING_WARNING, "WARNING"
|
STRING_WARNING, "WARNING"
|
||||||
STRING_INFO, "Information"
|
STRING_INFO, "Information"
|
||||||
|
|
||||||
STRING_UNTITLED, "(untitled)"
|
STRING_UNTITLED, "Untitled"
|
||||||
|
|
||||||
STRING_ALL_FILES, "All files (*.*)"
|
STRING_ALL_FILES, "All files (*.*)"
|
||||||
STRING_TEXT_FILES_TXT, "Text files (*.txt)"
|
STRING_TEXT_FILES_TXT, "Text files (*.txt)"
|
||||||
|
|
|
@ -54,30 +54,23 @@ VOID ShowLastError(void)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the caption of the main window according to Globals.szFileTitle:
|
* Sets the caption of the main window according to Globals.szFileTitle:
|
||||||
* Notepad - (untitled) if no file is open
|
* Untitled - Notepad if no file is open
|
||||||
* Notepad - [filename] if a file is given
|
* filename - Notepad if a file is given
|
||||||
*/
|
*/
|
||||||
static void UpdateWindowCaption(void)
|
static void UpdateWindowCaption(void)
|
||||||
{
|
{
|
||||||
WCHAR szCaption[MAX_STRING_LEN];
|
WCHAR szCaption[MAX_STRING_LEN];
|
||||||
WCHAR szUntitled[MAX_STRING_LEN];
|
WCHAR szNotepad[MAX_STRING_LEN];
|
||||||
|
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szCaption, SIZEOF(szCaption));
|
|
||||||
|
|
||||||
if (Globals.szFileTitle[0] != '\0') {
|
|
||||||
static const WCHAR bracket_lW[] = { ' ','-',' ','[',0 };
|
|
||||||
static const WCHAR bracket_rW[] = { ']',0 };
|
|
||||||
lstrcat(szCaption, bracket_lW);
|
|
||||||
lstrcat(szCaption, Globals.szFileTitle);
|
|
||||||
lstrcat(szCaption, bracket_rW);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
static const WCHAR hyphenW[] = { ' ','-',' ',0 };
|
static const WCHAR hyphenW[] = { ' ','-',' ',0 };
|
||||||
LoadString(Globals.hInstance, STRING_UNTITLED, szUntitled, SIZEOF(szUntitled));
|
|
||||||
|
if (Globals.szFileTitle[0] != '\0')
|
||||||
|
lstrcpy(szCaption, Globals.szFileTitle);
|
||||||
|
else
|
||||||
|
LoadString(Globals.hInstance, STRING_UNTITLED, szCaption, SIZEOF(szCaption));
|
||||||
|
|
||||||
|
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, SIZEOF(szNotepad));
|
||||||
lstrcat(szCaption, hyphenW);
|
lstrcat(szCaption, hyphenW);
|
||||||
lstrcat(szCaption, szUntitled);
|
lstrcat(szCaption, szNotepad);
|
||||||
}
|
|
||||||
|
|
||||||
SetWindowText(Globals.hMainWnd, szCaption);
|
SetWindowText(Globals.hMainWnd, szCaption);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue