Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15525

Repaint the NonClient area with API

$
0
0
Ok, I'm in a long-running loop, and I want to give the user a bit of information about how we're progressing. And I want to do this in a form's titlebar.

Ok, easy enough, Me.Caption = "whatever" allows me to change it. And Me.Refresh makes sure it shows.

But Me.Refresh is overkill. I did the following, but I just want to check with others to make sure my thinking is correct:

Code:


Option Explicit

Private Declare Function SendMessageW Lib "user32" (ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long


Private Sub Form_Click()

    Const WM_NCPAINT      As Long = &H85&


    Do
        Me.Caption = "whatever"
        SendMessageW Me.hWnd, WM_NCPAINT, 0&, 0&


        ' ... do stuff, eventually exiting the loop.

    Loop

End Sub


Thanks,
Elroy

Viewing all articles
Browse latest Browse all 15525

Trending Articles