|
-
Feb 14th, 2003, 03:15 AM
#1
Thread Starter
Addicted Member
LockWindowUpdate () Simulation
Hi Folks, I am researching a way to simulate LockWindowUpdate
(). Why not simply use the real thing you ask? Simple, I don't
want to run the risk of another application unlocking what I
locked (due to the limitation of only being able to have 1 window
locked at a time). I have considered the idea of subclassing,
capturing a DC with SaveDC (), and then calling RestoreDC (),
everytime a painting message gets intercepted. Of course this
is just hypothetical. If anyone has additional ideas (or experience
on the subject) then by all means let me know. In case you
are wondering, my target object is an owner-draw ListBox... so
subclassing is already readily accessible.
Thanks,
-CC
-
Feb 14th, 2003, 06:57 AM
#2
Capturing the dc is of no use. You must call ValidateRect(hwnd, vbNull) in response to every WM_PAINT message you catch, and this doesn't prevent windows from making other changes to their windows (outside of WM_PAINT).
And it will make you application look as if it had crashed, but I suppose you are aware of that.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 14th, 2003, 01:59 PM
#3
Thread Starter
Addicted Member
Thanks Bee. What do you think about the idea of capturing the
original bitmap into a compatible copy and then performing a blit + ValidateRect () every time a WM_PAINT is intercepted?
-
Feb 14th, 2003, 05:45 PM
#4
Memory intensive, but if you really need it...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 14th, 2003, 06:25 PM
#5
Thread Starter
Addicted Member
Yeah, I probably need it. If you've ever made an owner drawn
listbox before you will note that there is alot more flicker than
a regular list box in various situations. LockWindowUpdate ()
fixes the problem beautifully (in fact its smoother than a normal
listbox); however, it has its limitations.
Thanks Bee,
-CC
-
Feb 14th, 2003, 06:48 PM
#6
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 19th, 2003, 11:55 PM
#7
Thread Starter
Addicted Member
beautiful
Just thought I would mention that this was a success. Upon
the first WM_PAINT in my locked state I grab a bitmap snapshot
from the listbox's DC. On all subsequent WM_PAINTs I simply
blit the snapshot to the listbox's DC followed by a ValidateRect
(). I then just repeat these refresh blits until my lock state is
removed (at which point I destroy my temporary resources and
refresh the listbox normally). Absolutely beautiful results.
-CC
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|