Results 1 to 3 of 3

Thread: Redrawing Desktop & All(Child) Windows

  1. #1

    Thread Starter
    Addicted Member Max_aka_NOBODY's Avatar
    Join Date
    Jul 2004
    Location
    Amman, Jordan
    Posts
    179

    Redrawing Desktop & All(Child) Windows

    I'm trying to draw some graphics on the desktop, but have found that the title bar\non-client area of most windows remains "stamped" with the graphics when the window is moved. In addition, I just realized that I don't know how to clear the destop of the picture.

    Thanx in advance.
    Please, put a checkmark ( ) or the word [RESOLVED] in your topic title if it was resolved, and rate the person who resolved it.

  2. #2
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    WGTN, New Zealand
    Posts
    338

    Re: Redrawing Desktop & All(Child) Windows

    This is because the standard user interface libraries don't expect anything other than the client-area of a window to be changed, making it slightly more efficient to only redraw what is expected to change. Try using the RedrawWindow function, but for the hWnd value, use 0 (or GetDesktop).

    RedrawWindow 0, ByVal 0, ByVal 0, RDW_INVALIDATE

    I don't think it will work, but it's worth a shot.

  3. #3
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Redrawing Desktop & All(Child) Windows

    Heres the full code: *Should work fine)

    VB Code:
    1. Private Const RDW_INVALIDATE = &H1    ' Invalidate and activate a paint event.
    2. Private Const RDW_ALLCHILDREN = &H80 ' Send to all children.
    3. ' Above will only work if the form is the main one.
    4. Private Declare Function RedrawWindow Lib "user32.dll" Alias "RedrawWindow" ( _
    5.     ByVal hWnd As Long, _
    6.     lprcUpdate As RECT, _
    7.     ByVal hrgnUpdate As Long, _
    8.     ByVal fuRedraw As Long) As Long
    9.  
    10. Dim lngFlags As Long
    11. Dim lngReturn As Long
    12. lngFlags = RDW_INVALIDATE + RDW_ALLCHILDREN ' The flags...
    13. lngReturn = RedrawWindow(Me.hwnd, ByVal 0&, ByVal 0&, lngFlags)
    14. If lngReturn <> 0 Then
    15.     ' Function worked!
    16. End If

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

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