Hi guys,

i wrote a credit-box for my about-dialog in asm. But when the text scrolls the whole screen flickers :X

what can i do?

here ist my code. i dont know wether it is alright :X
.386
.model flat,stdcall
option casemap:none

include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib

DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD
Paint**** proto :DWORD

.data
OurText db "Bla test Bla test Bla test Bla test Bla test Bla test Bla test Bla test Bla test Bla test ", 0
NewTop dd 220

.data?
hInstance HINSTANCE ? 


.const
IDC_EXIT dd 1002

.code
start:

invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,1001,NULL,addr DlgProc,NULL
invoke ExitProcess,eax


DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
LOCAL hdc:HDC
LOCAL ps:PAINTSTRUCT
LOCAL rect:RECT

.if uMsg == WM_INITDIALOG
push hWnd
invoke SetTimer, hWnd, 20, 60, addr Paint****

.elseif uMsg==WM_PAINT

invoke BeginPaint,hWnd, ADDR ps
mov hdc,eax
invoke GetClientRect,hWnd, ADDR rect
mov eax, NewTop
mov rect.top, eax

invoke DrawText, hdc,ADDR OurText,-1, ADDR rect, DT_WORDBREAK or  DT_CENTER 
invoke EndPaint,hWnd, ADDR ps

.elseif uMsg== WM_CLOSE
invoke EndDialog,hWnd,0
.endif       
xor eax,eax
ret
DlgProc endp

Paint**** proc hWnd:HWND


mov eax, NewTop
.if eax==-50
mov eax, 220
.endif
dec eax
mov NewTop, eax

invoke InvalidateRect,hWnd,0,TRUE

ret
Paint**** endp

end start
Posted on 2006-07-11 16:41:27 by n0p
You'll need to use double-buffering.

Check this tutorial out.

Posted on 2006-07-11 17:31:15 by arafel
okay, i have read it oO

but i dont understand this complete tutorial :X
Can u help me?

how should i use the code from the tutrial?
Posted on 2006-07-11 17:57:02 by n0p
Basically, instead of just drawing directly on the form, you need to make a new DC that is a Back Buffer, and draw on it, and then draw the entire Back Buffer onto the form. That eliminates the flacker from drawing each thing individually onto the form.
Posted on 2006-07-11 19:36:31 by Bobbias
yeah i get it :D
No Flickers anymore.
Posted on 2006-07-12 08:15:34 by n0p