The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: newAsm on June 09, 2010, 10:07:08 AM

Title: API to freeze screen before updating it
Post by: newAsm on June 09, 2010, 10:07:08 AM
Hi,

I am asking a stupid question but I am not sure which API is the best. I want to prevent the screen flickering when I am doing drawing on the application window. Which API should I use to save the desktop or application window and then release it for update. Your knowledge would be helpful.

Thanks..newAsm
Title: Re: API to freeze screen before updating it
Post by: Tedd on June 09, 2010, 10:45:08 AM
Try WM_SETREDRAW, but it depends what you're drawing on.


invoke SendMessage, hCtrl,WM_SETREDRAW,FALSE,0
;...do your drawing/modifying...
invoke SendMessage, hCtrl,WM_SETREDRAW,TRUE,0


If you're drawing to the DC yourself, you should create a memory DC, draw to that, and then bitblt to the window DC in one go when you're finished.
Title: Re: API to freeze screen before updating it
Post by: Ghandi on June 09, 2010, 11:32:26 AM
Yep, double buffering is the way to go if you want to minimize or prevent screen flicker. Tedd is absolutely correct, do your manipulations on the memory DC and then a single BitBlt will paint it in one operation.

HR,
Ghandi
Title: Re: API to freeze screen before updating it
Post by: sysfce2 on June 12, 2010, 11:34:44 PM
Here is a handy reference that might help:

http://catch22.net/tuts/flicker