?
Solved

Is there a way to make a pageflipping form?

Posted on 1998-07-09
7
Medium Priority
?
162 Views
Last Modified: 2010-04-04
I have an application which does a lot of manual painting (including filling the background on WM_ERASEBKGND). The problem is when I do things like changing the text of a label run-time, I get some flashing. Sometimes only the control itself, but sometimes the whole form. I would like to do some sort of pageflipping to avoid this. Any suggestions? My first thought was to change the form's device context to a memory-dc, and then copy the whole image to the screen, but it is read only... And would this be awfully slow?

/Pede
0
Comment
Question by:pede
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:BlackMan
ID: 1357458
You could try the LockWindowUpdate function. Here is a snip from the description:

The LockWindowUpdate function disables or reenables drawing in the specified window. Only one window can be locked at a time.

BOOL LockWindowUpdate(

    HWND hWndLock       // handle of window to lock  
   );      
 
0
 
LVL 1

Author Comment

by:pede
ID: 1357459
I forgot to mention that I already use the LockWindowUpdate. It helps quite a bit, but it's not even close to perfect.

Sorry, my mistake.

/Pede

0
 
LVL 1

Author Comment

by:pede
ID: 1357460
What about only unlocking the window in the vertical retrace period? Like, LockWindowUpdate(Handle), do stuff, WaitforVerticalBlanc, LockWindowUpdate(0).

How do I wait for vertical retrace? It has to run on both 3.1, 95 and NT.

/Pede

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
Matvey earned 300 total points
ID: 1357461
pede, I think that the best thing to help you is some sources. You can find a unit at the following address that has a method to avoid the fliccering:

http://bes.trendline.co.il/torry/vcl/packs/yupack.zip

Look at the sources for the button and the drawing procedures at the end of the unit.

Cheers, bosism@netvision.net.il
0
 
LVL 1

Author Comment

by:pede
ID: 1357462
Well, this source definately works. But I was hoping for a more 'global' solution. This way I have to make a custom class (with quite a lot of code in it) for every control I use. I get the idea though, and I will reduce some of the worst flickering this way.

Cheers,

/Pede

0
 
LVL 1

Author Comment

by:pede
ID: 1357463
Actually I have another comment, if anybody finds this subject interesting. I wrote that the LockWindowUpdate()-method helped quite a bit. Well, in some ways it does, but sometimes it makes the whole client area flash when you unlock it! If the whole point is to make a flicker-free application, that's pretty bad ...
So far the only bulletproof way (that  I know of), is to do a lot of blitting  yourself. This is how it's done in the source suggested by Matvey.

/Pede

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1357464
You don't have to implement many time the same drwing procedure you see in the unit, and you don't necessary need classes for them. You can copy the methods to one unit and add it to the USES clause whenever you need drawing for your application.

Sorry if my answere wasn't helpful to you. I'll try my best to help you farther if you have problems,
Regards, Matvey
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question