And now how to animate:
add all the images in the resource.
500 IMAGE "titi\\titi1.gif"
501 IMAGE "titi\\titi2.gif"
502 IMAGE "titi\\titi3.gif"
503 IMAGE "titi\\titi4.gif"
create the bmp and put them in an array (WM_CREATE):
mov dword ptr [TabTitibmp],1 ;TabTitibmp dd 5 dup (0)
mov ecx,1
mov titiindice,500
;sauvegarde first region
saveBmp:
mov ecx,dword ptr [TabTitibmp]
mov eax,Hbmp
mov dword ptr [TabTitibmp+ecx*4],eax
inc titiindice
.if titiindice < 504
invoke Load_IMAGE,titiindice ;addr modulepath
mov Hbmp,eax
inc dword ptr [TabTitibmp]
jmp saveBmp
.endif
;
mov ecx,1
mov [TabTitibmp],ecx
push dword ptr [TabTitibmp+4]
pop Hbmp
;create timer
invoke SetTimer,hwnd,500,100,NULL
and now add the WM_TIMER message
.elseif uMsg == WM_TIMER
mov ecx,dword ptr [TabTitibmp]
.if ecx < 4
inc ecx ;1
.else
mov ecx,1
.endif
mov dword ptr [TabTitibmp],ecx
mov eax,dword ptr [TabTitibmp+ecx*4]
mov Hbmp,eax
invoke BmpToRgn,Hbmp,TransparantColor ;only one use
mov Hrgn,eax
invoke GetClientRect,hwnd,ADDR rect
invoke RedrawWindow,hwnd,addr rect,Hrgn,RDW_INTERNALPAINT
NOTE:
invoke SetWindowRgn,hwnd,Hrgn,TRUE
;After a successful call to SetWindowRgn, the system owns the region
;specified by the region handle hRgn. The system does not make a copy of the
; region. Thus, you should not make any further function calls with this region
; handle. In particular, do not delete this region handle. The system deletes
; the region handle when it no longer needed