When I update an edit box constantly it appears to flicker if the content is the same as the new string. I wanted to get rid of this; so i wrote this code. It works fine, but after 10 or 11 seconds it just gives me the illegal opp box. I am just trying to have a few edit boxes showing the correct time... with no flicker.

update:

invoke GetSystemTime, addr systime

invoke wsprintf, addr currhour, addr template, systime.wHour
invoke wsprintf, addr currmin, addr template, systime.wMinute
invoke wsprintf, addr currsec, addr template, systime.wSecond
invoke wsprintf, addr currdow, addr template, systime.wDayOfWeek
invoke wsprintf, addr currday, addr template, systime.wDay
invoke wsprintf, addr currmonth, addr template, systime.wMonth
invoke wsprintf, addr curryear, addr template, systime.wYear

invoke GetDlgItemText, dialoguehand, EDIT_CURRSEC, addr buff, 8
invoke lstrcmp, addr buff, addr currsec

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRSEC,addr currsec

invoke GetDlgItemText, dialoguehand, EDIT_CURRMIN, addr buff, 8
invoke lstrcmp, addr buff, addr currmin

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRMIN,addr currmin

invoke GetDlgItemText, dialoguehand, EDIT_CURRHOUR, addr buff, 8
invoke lstrcmp, addr buff, addr currhour

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRHOUR,addr currhour

invoke GetDlgItemText, dialoguehand, EDIT_CURRDAY, addr buff, 8
invoke lstrcmp, addr buff, addr currday

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRDOW,addr currdow
invoke SetDlgItemText,dialoguehand,EDIT_CURRDAY,addr currday

invoke GetDlgItemText, dialoguehand, EDIT_CURRMONTH, addr buff, 8
invoke lstrcmp, addr buff, addr currmonth

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRMONTH,addr currmonth

invoke GetDlgItemText, dialoguehand, EDIT_CURRYEAR, addr buff, 8
invoke lstrcmp, addr buff, addr curryear

.if eax != 0

invoke SetDlgItemText,dialoguehand,EDIT_CURRYEAR,addr curryear

.endif
.endif
.endif
.endif
.endif
.endif

jmp update

the idea is to only update the minutes if the seconds have changed, the hours if the minutes have changed, the days if the hours have changed etc. i think this is the best way to do it but if you know a better way then please let me know. I have no idea why it isnt working.

thanks in advance.

skud.
Posted on 2001-09-03 10:30:29 by skud
In your loop you never let Windows do its stuff.

You should create a timer that fire an event every second
or so. I guess you run out of memory.

KetilO
Posted on 2001-09-03 13:43:23 by KetilO
i create a new thread to do this.
all the other stuff is handled in the main thread.

thanks anyway.
skud.
Posted on 2001-09-03 14:07:06 by skud