Solved

Is there a way to make a pageflipping form?

Posted on 1998-07-09
7
138 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
  • 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Accepted Solution

by:
Matvey earned 100 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now