I am using masm32 with RadASM to create a simple dialog with nothing else on it.

RadASM sets up a bunch of windows messages to look out for (eg WM_COMMAND and WM_PAINT) so what I did was create a seperate procedure that would draw a square on a given hDC. This proc is called DrawBox. I put a call to DrawBox when WM_PAINT is sent to my dialog. This seems to work ok.

Next comes the animation. My proc can draw a box at any angle you want. To make the box spin I used SetTimer to create a timer with an interval of 10 milliseconds. Then in the dialog's WM_TIMER event I incremented the angle to draw the box at and then sent a WM_PAINT message to my dialog so that it would draw it. This didn't seem to work until I called InvalidateRect which clears the contents of the dialog's hDC and forces it to repaint. The problem with doing this is that I always get quite a lot of flicker as the box spins round.

Basically how do I get rid of this flicker, or, is there a better way to repeatedly draw on my dialog?

Also as a sub question how do I do the following (which obviously won't work)



.data?
myRealValue dt ?

.code
mov myRealValue, 0.1


I've mainly been learning by example and haven't seen how to do this anywhere. I know I can intialize the variable in the .data section, but what if I wanted to change the value of myRealValue later on?
Posted on 2003-11-24 18:17:18 by DeX
1) Back buffer

2) This is a limitation of MASM. The largest immediate move is for four bytes.
Here is the specific solution to moving 0.1:
	mov	DWORD PTR myRealValue +0, 0

mov DWORD PTR myRealValue +4, 80000000h
mov WORD PTR myRealValue +8, 3FFFh
Posted on 2003-11-24 20:45:38 by bitRAKE