Hi! all

my problem is that i want to print the date but
the result is strange caracters

STime resb SYSTEMTIME_size
Dia dd 0
Mes dd 0
Ano dd 0

call GetSystemTime,STime
mov eax,
mov ,eax
mov eax,
mov ,eax
mov eax,
mov ,eax


call TextOutA,,250,70,,2
call TextOutA,,300,70, ,2
call TextOutA,,400,70,,4

where is the error?
Posted on 2001-09-17 12:33:08 by Nguga
Ok, first of all SystemTime structure is already defined in your Window.inc in the masm32 include directory; so:

wYear WORD ?
wMonth WORD ?
wDayOfWeek WORD ?
wDay WORD ?
wHour WORD ?
wMinute WORD ?
wSecond WORD ?
wMilliseconds WORD ?

So you can simply state as .data?:


And call the API as:

invoke GetSystemTime, addr SysTime

Now your structure is filled with the desired informations, and you can retrieve them simply as, for example:

mov ax, SysTime.wYear ; since each entry is a word

The problem here is that the numbers are, of course, in hex format... so Year 2001 will be in ax as 07D1. To display such info you had first to convert it into ASCII decimal:

07D1 --> 32 30 30 31

There are a lot of useful routines to perform such a translation, or you can possibly write your own. If you need I can send you my routines to perform such task (but i think much better ones are already coded in masm32 lib).

I hope this can help.
Bye, Saiwa :alright:
Posted on 2001-09-17 14:30:10 by Saiwa
Hey Nguga...that worked fine in my prog but only after i corrected something. I tried to declare the structure myself and got an error that said it was improperly defined. I used your structure as you typed it. Do you think i got the error because i was trying to define it and it was already in the windows.inc file or do you think maybe the variables might be double word or something. The only reason i ask is because i have never made my own structure and any help with the proper syntax for structures in Masm is appreciated.

Posted on 2001-09-17 15:22:59 by titan
well sorry i did not say but i was coding Nasm

this is in my win32n.inc

.wYear RESW 1
.wMonth RESW 1
.wDayOfWeek RESW 1
.wDay RESW 1
.wHour RESW 1
.wMinute RESW 1
.wSecond RESW 1
.wMilliseconds RESW 1

titan as you can see the syntax is for Nasm not
Masm ...

in Nasm you just make:

AnyName resb SYSTEMTIME_size

in order tu use a Structure


Thank very much the result is in hex format
if you have some rotines please give me an example ..
Posted on 2001-09-18 10:54:17 by Nguga