Results 1 to 3 of 3

Thread: Not very refreshing?

  1. #1
    Guest

    Unhappy

    Does anyone know how I can refresh the whole screen including objects outside my visual basic project?

    I am assuming that this will require some kind of API call.

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I can think of 2 ways of doing it, The first way is much easier and faster and works a lot better that I anticipated, so use that.


    you need these APIs
    Code:
    Private Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    and just call it with
    Code:
    Call UpdateWindow(GetDesktopWindow)
    this refreshes the desktop window, which basicly means the screen

    Just in case you're interested the secons uses EnumWindows to Get a handle to every window on the screen and refreshes them all individually

    Put this in a standard module

    Code:
    Private Declare Function UpdateWindow Lib "user32" (ByVal hWnd As Long) As Long
    
    
    Public Sub RefreshScreen()
    Call EnumWindows(AddressOf EnumProc, 0)
    End Sub
    
    
    Public Function EnumProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
    
    Call UpdateWindow(hWnd)
    EnumProc = 1
    End Function
    Then use RefreshScreen to refresh the whole screen.

    Use the first one.
    If it wasn't for this sentence I wouldn't have a signature at all.

  3. #3
    Guest

    Thumbs up

    Thankyou that was very helpful!

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