DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Making it look nice

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Making it look nice

    [Originally posted by IvyS]

    I've written a long VBA macro that uses a series of forms to prompt users for input. While this macro is running, I don't want users to see the changes it's making to the underlying data. I've tried using Application.ScreenUpdating = False, but this has the side effect of leaving "ghost images" of bits of previously displayed forms on the screen. Is there a way to either display something other than the worksheet as a background or to clean away these ghosts without setting ScreenUpdating to true?

    Thanks!

    Ivy

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Making it look nice

    [Originally posted by Greg DeBacker]

    In VB I would use something like the code below. You can only call LockWindow() on one window at a time. It will prevent any changes to the window. Also, it will lock which ever window is activated whether it is your application or not, so be carefull, and be sure to UnlockWindow() when you're done.

    Greg


    'Copy this code into a module

    Declare Function GetActiveWindow Lib "USER32" () As Long
    Declare Function LockWindowUpdate Lib "USER32" (ByVal hwndLock As Long) As Long


    Sub LockWindow()
    Dim Apphwnd As Long
    Apphwnd = GetActiveWindow()
    Call LockWindowUpdate(Apphwnd)
    End Sub
    Sub UnlockWindow()
    Call LockWindowUpdate(0)
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center