Freezing Screen Updates with VBA 
Author Message
 Freezing Screen Updates with VBA

I have an application that makes the screen scroll. This is
disconcerting and I would like to make it stop while the code is
running. I have searched this site for this topic and found this one
post on the subject,

http://www.*-*-*.com/ ,

but it appears incomplete and the link mentioned
is no longer viable.

Has anyone got any information on using this API or another way to
freeze the screen without using the 'Visible' property.


Mon, 13 Jun 2005 22:59:59 GMT  
 Freezing Screen Updates with VBA
...forgot to mention I was using MSP2K and Windows2K Pro

Tue, 14 Jun 2005 21:46:07 GMT  
 Freezing Screen Updates with VBA
One simple way to do it is to use the "WindowState" property to
minimize the window while the code is running and then set it back to
normal when the code is through.


Wed, 15 Jun 2005 07:01:29 GMT  
 Freezing Screen Updates with VBA
I tried this and several others they all produce irritating screen
jumps/moves/flickering. While I was waiting for an answer to this post
I solved the problem. I was prowling through the API docs and found a
combination of two functions that work. They are "LockWindowUpdate"
which requires a window handle you can get from the "FindWindow"
Declaration statements are as follows:

Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function LockWindowUpdate Lib "user32" _
(ByVal hwndLock As Long) As Long

Implementation is simply:
LockWindowUpdate FindWindow(vbNullString, Caption)

To unlock the window use:
LockWindowUpdate False
LockWindowUpdate 0

A word of warning, this can be a dangerous function, trap for errors
and unlock the window in the error routine because if the routine
crashes you will have to re-start the app to see updates again.

Also, place the unlock call prior to the last update or you will have
to create something that will re-paint the screen (SelectBeginning) in
order to see any updates that might have happened during the lock.
This may not be necessary depending on why you locked the screen in
the first place.

The LockWindowUpdate function works beautifully and was exactly what I
was looking for. Hope others find it useful.

Steve Nance

Thu, 16 Jun 2005 22:17:16 GMT  
 [ 4 post ] 

 Relevant Pages 

1. Freezing screen updates

2. Freeze the screen

3. Project 98 - How to freeze screen?

4. Freeze screen

5. Screen freeze when pinging....

6. Frozen Screen

7. Screen Freeze

8. Screen Freeze

9. Screen Freeze Net

10. Screen Freeze Net

11. Screen Freeze

12. Screen freeze using vbscrip5.chm


Powered by phpBB® Forum Software