X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsys%2Fsystem%2Fnotepad%2Fdialog.c;h=a44a1c6d5b5713a486e2182e8bd0327afb39b463;hp=4ad17bf17dcc446549157a964eda984a684952d0;hb=94cc96262bdb75c5fd0f14ee01ef9bead6620107;hpb=05a74dc2dd12d3b4a2dd465d754f7c257cf185bc;ds=sidebyside diff --git a/reactos/subsys/system/notepad/dialog.c b/reactos/subsys/system/notepad/dialog.c index 4ad17bf17dc..a44a1c6d5b5 100644 --- a/reactos/subsys/system/notepad/dialog.c +++ b/reactos/subsys/system/notepad/dialog.c @@ -271,11 +271,13 @@ BOOL DoCloseFile(void) void DoOpenFile(LPCWSTR szFileName) { + static const WCHAR dotlog[] = { '.','L','O','G',0 }; HANDLE hFile; LPSTR pTemp; LPWSTR pTemp2 = NULL; DWORD size; DWORD dwNumRead; + WCHAR log[5]; LPWSTR p; LPBYTE p2; int iCodePage; @@ -375,6 +377,18 @@ void DoOpenFile(LPCWSTR szFileName) SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0); SendMessage(Globals.hEdit, EM_EMPTYUNDOBUFFER, 0, 0); SetFocus(Globals.hEdit); + + /* If the file starts with .LOG, add a time/date at the end and set cursor after + * See http://support.microsoft.com/?kbid=260563 + */ + if (GetWindowTextW(Globals.hEdit, log, sizeof(log)/sizeof(log[0])) && !lstrcmp(log, dotlog)) + { + static const WCHAR lfW[] = { '\r','\n',0 }; + SendMessage(Globals.hEdit, EM_SETSEL, GetWindowTextLength(Globals.hEdit), -1); + SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW); + DIALOG_EditTimeDate(); + SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM)lfW); + } SetFileName(szFileName); UpdateWindowCaption();