hello! everybody.
at the test_ico code ,500ms timer is not the equality in every 500ms times. first 500ms timer = second 500ms timer = third 500ms timer, fourth 500ms timer = fifth 500ms timer = sixth 500ms timer,
but third 500ms timer != fourth 500ms timer.
and so on.
that's why?
Posted on 2004-11-11 01:20:23 by dcskm4200
		.data?


hIcon1 dd ?
hIcon2 dd ?
hIcon3 dd ?

hInstance dd ?
hWinMain dd ?
dwCount dd ?
idTimer dd ?
seed DWORD ?



;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;---------------------------------------------------------------------
TRand proc Range:DWORD

LOCAL TempInt:DWORD
LOCAL RMax:DWORD

TRAND_MAX equ 32767

mov eax, TRAND_MAX
mov RMax, eax
mov eax, seed
imul eax, eax,343FDh
add eax, 269EC3h
mov seed,eax
sar eax,10h
and eax,7FFFh
mov TempInt, eax
fild TempInt
fild RMax
fdivp st(1), st(0)
fild Range;
fmulp st(1), st(0)
fistp TempInt
mov eax, TempInt;
ret

TRand endp
;---------------------------------------------------------------------
ProcTimer proc _hWnd,_uMsg,_idEvent,_dwTime

pushad
invoke TRand,800 ;eax=Randnum in [0-800]
invoke SetDlgItemInt,hWinMain,IDC_RANDNUM,eax,FALSE
popad
ret

ProcTimer endp
;---------------------------------------------------------------------
ProcDlgMain proc uses ebx edi esi,hWnd,uMsg,wParam,lParam

mov eax,uMsg
;---------------------------------------------------------------------
.if eax == WM_TIMER
mov eax,wParam
.if eax == ID_TIMER1

inc dwCount

mov eax, dwCount

invoke SendDlgItemMessage,hWnd,IDC_SETICON,STM_SETIMAGE,IMAGE_ICON,[hIcon1+eax*4]

cmp dwCount, 2
jne @f
mov dwCount, -1
@@:
.endif
;---------------------------------------------------------------------
.elseif eax == WM_INITDIALOG
push hWnd
pop hWinMain
invoke SetTimer,hWnd,ID_TIMER1,500,NULL ;100ms timer update ICO
invoke SetTimer,NULL,NULL,1000,addr ProcTimer ;1000ms timer update ProcTimer process??

invoke LoadIcon,hInstance,1
mov [hIcon1], eax
invoke LoadIcon,hInstance,2
mov [hIcon2], eax
invoke LoadIcon,hInstance,3
mov [hIcon3], eax

mov idTimer,eax

mov dwCount, -1
;---------------------------------------------------------------------
.elseif eax == WM_CLOSE
invoke KillTimer,hWnd,ID_TIMER1
invoke KillTimer,NULL,idTimer
invoke EndDialog,hWnd,NULL
;---------------------------------------------------------------------
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
mov seed,1
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset ProcDlgMain,NULL
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
Posted on 2004-11-11 08:50:55 by arafel
ok!
you are a Code Warrior as sharp as a razor.
thanks you very much.
:lol:
Posted on 2004-11-11 10:05:26 by dcskm4200