The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: herge on September 24, 2008, 06:43:56 PM

Title: SHOWTIME
Post by: herge on September 24, 2008, 06:43:56 PM

Hi All:

A relatively short program that displays the
System Date & Time.


; REM SHOWTIME.ASM  Wednesday, September 24, 2008 2:30 PM
; by herge - Show System Date & Time
include \masm32\include\masm32rt.inc
.data
stm  SYSTEMTIME<>
    org stm; Must be eight words
wYear dw 0
wMonth dw 0
wToDay dw 0 ; Sunday 0 to Saturday 6
wDay    dw 0
wHour   dw 0
wMinute dw 0
wSecond dw 0
wKsecond dw 0
date_buf   db 50 dup (32)
time_buf   db 20 dup (32)
           db 0
dateformat  db " dddd, MMMM, dd, yyyy", 0
timeformat db "hh:mm:ss tt",0
.code
Start:
;  invoke   GetLocalTime, addr stm
;  invoke   GetDateFormat, 0, 0, \
;           ADDR stm, ADDR dateformat, ADDR date_buf, 50
   invoke   GetDateFormat, 0, 0, \
            0, ADDR dateformat, ADDR date_buf, 50
   mov   ecx, offset date_buf
   add   ecx, eax; add length returned by GetDateFormat
   mov   byte ptr [ecx-1], " " ;replace null with space
   invoke   GetTimeFormat, 0, 0, \
            0, ADDR timeformat, ecx, 20
   invoke   MessageBox, 0, addr date_buf, addr date_buf, MB_OK
   invoke ExitProcess, 0
end Start



Regards herge
Title: Re: SHOWTIME
Post by: Bill Cravener on September 24, 2008, 07:33:35 PM
Quote from: herge on September 24, 2008, 06:43:56 PM
Hi All:

A relatively short program that displays the System Date & Time.

Your learning buddy!!  :bg
Title: Re: SHOWTIME
Post by: herge on September 24, 2008, 07:46:44 PM
 Hi Cycle Saddles:

Yes it is fairly short.
I even changed

dec ecx
mov byte ptr [ecx], " "
inc ecx



mov   byte ptr [ecx-1], " " ;replace null with space


Regards herge
Title: Re: SHOWTIME
Post by: Bill Cravener on September 24, 2008, 07:54:10 PM
Keep at it herge. Before long you'll be coding thousands of lines of asm code so don't be afraid to post your source code here. I love reading assembly language, its more fun then smoking marijuana. (http://www.quickersoft.com/gigglesmile.gif)
Title: Re: SHOWTIME
Post by: Mark Jones on September 24, 2008, 08:46:18 PM
...it's a good thing only the Politicians inhale. :U