Hi 1. I am trying to make a simple program that will show a local time in a window. I used SYSTEMTIME (what else?) structure. Now i have problems how to show it in a window. I used wsprintf then SetDlgItemText. And this combination works fine: wsIspis db "%d",0 invoke GetLocalTime,ADDR stime mov cx,stime.wHour invoke wsprintf,ADDR buff,ADDR wsIspis,cx invoke SetDlgItemText,hWnd,2,ADDR buff mov dx,stime.wMinute invoke wsprintf,ADDR buff,ADDR wsIspis,dx invoke SetDlgItemText,hWnd,3,ADDR buff mov bx,stime.wSecond invoke wsprintf,ADDR buff,ADDR wsIspis,bx invoke SetDlgItemText,hWnd,4,ADDR buff You can see that i am using 3 control boxes for the output. I tried with only one control box, but here comes the problem. It display hour ok, but minutes and seconds are 'strange' big numbers. How to solve this problem? 2. This program displays numbers less then 10 with 1 character and when i use WM__CTLCOLORSTATIC for paint this in a color (let's say Blue) it can't do refreshing. I want to say that when seconds are going from 59 to 0 i can see this number nine (when it is counting to the 10 ) and i don't want that. Where is the problem? What message to send to windows (or what)? Thank you greetings
Posted on 2001-06-08 13:50:00 by stanks
Ewayne's AsmEdit editor displays the current time in hour,minutes and seconds in its status bar. Take a look at his source code he offers at compare it with yours. Other than that im of no use. smurf
Posted on 2001-06-08 14:12:00 by smurf
Use the time, localtime and asctime functions to convert the current time to a string. For example :

; time struct declaration
tm_sec	SWORD	?    ; seconds after the minute - [0,59]
tm_min	SWORD	?    ; minutes after the hour - [0,59] 
tm_hour	SWORD	?    ; hours since midnight - [0,23] 
tm_mday	SWORD	?    ; day of the month - [1,31] 
tm_mon	SWORD	?    ; months since January - [0,11] 
tm_year	SWORD	?    ; years since 1900 
tm_wday	SWORD	?    ; days since Sunday - [0,6] 
tm_yday	SWORD	?    ; days since January 1 - [0,365] 
tm_isdst SWORD	?    ; daylight savings time flag 

; prototypes
asctime   PROTO C :DWORD
time      PROTO C :DWORD
localtime PROTO C :DWORD

t DWORD ? ; current time (in seconds elapsed since 01/01/1970)

	INVOKE	time, NULL              ; get time
	mov     t, eax
	INVOKE  localtime, OFFSET t     ; get a time struct
	INVOKE  asctime, eax            ; convert it to string
	INVOKE  MessageBox, NULL, eax, NULL, MB_OK   
If you use the functions, don't forget to link your program with msvcrt.lib. Good luck!
Posted on 2001-06-08 15:38:00 by karim
Thank you very much karim greetings
Posted on 2001-06-08 16:31:00 by stanks
I used GetTimeFormat and it works well. .data timebuffer db "99:99:99",0 .code invoke GetTimeFormat,NULL,TIME_FORCE24HOURFORMAT ,\ NULL,NULL,addr timebuffer,9 invoke SetWindowText,hWnd,addr timebuffer gives you a string like "21:48:54" in timebuffer This message was edited by brewmanchu, on 6/8/2001 9:41:33 PM
Posted on 2001-06-08 21:40:00 by brewmanchu
I will try this too. Thank you brewmanchu greetz
Posted on 2001-06-09 03:23:00 by stanks