mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
/* npdate - Code for getting and inserting current date and time.
|
|
* Copyright (C) 1984-1995 Microsoft Inc.
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
|
|
/* ** Replace current selection with date/time string.
|
|
* if fCrlf is true, date/time string should begin
|
|
* and end with crlf
|
|
*/
|
|
VOID FAR InsertDateTime (BOOL fCrlf)
|
|
{
|
|
SYSTEMTIME time ;
|
|
TCHAR szDate[80] ;
|
|
TCHAR szTime[80] ;
|
|
DWORD locale;
|
|
|
|
locale= MAKELCID( MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), SORT_DEFAULT) ;
|
|
|
|
// Get the time
|
|
GetLocalTime( &time ) ;
|
|
|
|
// Format date and time
|
|
GetDateFormat(locale,DATE_SHORTDATE,&time,NULL,szDate,CharSizeOf(szDate));
|
|
GetTimeFormat(locale,TIME_NOSECONDS,&time,NULL,szTime,CharSizeOf(szTime));
|
|
|
|
if( fCrlf )
|
|
SendMessage(hwndEdit, EM_REPLACESEL, 0, (LONG)TEXT("\r\n") );
|
|
|
|
SendMessage(hwndEdit, EM_REPLACESEL, 0, (LONG)szTime );
|
|
SendMessage(hwndEdit, EM_REPLACESEL, 0, (LONG)TEXT(" ") );
|
|
SendMessage(hwndEdit, EM_REPLACESEL, 0, (LONG)szDate );
|
|
|
|
if( fCrlf )
|
|
SendMessage(hwndEdit, EM_REPLACESEL, 0, (LONG)TEXT("\r\n") );
|
|
|
|
}
|