Results 1 to 7 of 7

Thread: LockWindowUpdate () Simulation

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Middle Earth
    Posts
    156

    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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Middle Earth
    Posts
    156
    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?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Middle Earth
    Posts
    156
    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

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I haven't.
    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.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Middle Earth
    Posts
    156

    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
  •  



Click Here to Expand Forum to Full Width