i'm working on the new interface for my program and i'm using dialogbox just to make my work just a little bit easier.
i'm using dib for the animations (drawing the stuff first into another dc) and then bitblt to copy it to the original dc everything seems to be fine except i if i add any control to my dialogbox control itself starts to flicker!but i found out that the redrawwindow windows api causes this since that's what i've used to update the window after doing the animations.
proc DlgProc uses ebx esi edi,hwndDlg,uMsg,wParam,lParam
local dummy dd ?
mov eax,[uMsg]
mov ebx,[wParam]
cmp eax,WM_INITDIALOG
je InitlizeApp
cmp eax,WM_CLOSE
je EndApp
cmp eax,WM_LBUTTONDOWN
je DragApp
cmp eax,WM_RBUTTONUP
je EndApp
cmp eax,WM_PAINT
je Paint
cmp eax,WM_TIMER
je Timer
cmp eax,WM_COMMAND
je BtnClk
cmp eax,WM_ERASEBKGND
je ProcessedMsg
xor eax,eax
jmp Finish
InitlizeApp:
push [hwndDlg]
pop [hwnd]
invoke SetTimer,[hwnd],1,1,0
invoke SetTimer,[hwnd],2,100,0
;stdcall uFMOD_PlaySong,Song,0,XM_RESOURCE
stdcall InitlizeGFX
jmp ProcessedMsg
DragApp:
stdcall DragObj,[hwnd]
jmp ProcessedMsg
Timer:
.if ebx = 1
stdcall DrawGFX
.elseif ebx = 2
stdcall TrnOptions
.endif
jmp ProcessedMsg
Paint:
stdcall CpyGFX
jmp ProcessedMsg
EndApp:
stdcall GFXShutDown
;stdcall uFMOD_PlaySong,0,0,0
invoke EndDialog,[hwnd],0
BtnClk:
cmp bx,1
jne ProcessedMsg
ProcessedMsg:
mov eax,1
Finish:
ret
endp
proc CpyGFX
local ps PAINTSTRUCT
mov ebx,[hwnd]
lea esi,[ps]
invoke BeginPaint,ebx,esi
invoke BitBlt,[hdc],0,0,ScreenWidth,ScreenHeight,[CanvasDc],0,0,SRCCOPY
invoke EndPaint,ebx,esi
ret
endp
proc DrawGFX
mov edi,[CanvasBuf]
mov ecx,ScreenWidth * ScreenHeight
xor eax,eax
repe stosd
call DrawStars
stdcall SetText,180,87,PrText,[bmpFont],0
stdcall DrawBitmapImg,0,0,[MainImgData],0,0
invoke GetClientRect,[hwnd],rc
invoke RedrawWindow,[hwnd],rc,0,RDW_INVALIDATE
ret
endp