|
-
May 31st, 2008, 11:44 PM
#1
Thread Starter
Hyperactive Member
Refresh ListView With APIs
How can I refresh a ListView using APIs? SendMessage? What arguements? Thank you
-
Jun 1st, 2008, 03:44 AM
#2
Re: Refresh ListView With APIs
Not sure what you mean by refresh, but heres some code used to suppress redraw.
You could try, Redraw ListView1.hWnd, and see if that helps.
Code:
Private Const RDW_ERASE As Long = &H4&
Private Const RDW_INVALIDATE As Long = &H1&
Private Const RDW_ALLCHILDREN As Long = &H80&
Private Const RDW_UPDATENOW As Long = &H100&
Private Const WM_SETREDRAW = &HB
Private Declare Function RedrawWindow Lib "user32.dll" ( _
ByVal hWnd As Long, ByVal lprcUpdate As Long, _
ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Sub SupressRedraw(ByVal hWnd As Long)
Call SendMessage(hWnd, WM_SETREDRAW, 0, ByVal 0&)
End Sub
Public Sub Redraw(ByVal hWnd As Long)
Call SendMessage(hWnd, WM_SETREDRAW, 1, ByVal 0&)
Call RedrawWindow(hWnd, ByVal 0&, 0, RDW_ERASE Or _
RDW_INVALIDATE Or _
RDW_ALLCHILDREN Or _
RDW_UPDATENOW)
End Sub
-
Jun 1st, 2008, 04:49 AM
#3
Re: Refresh ListView With APIs
I ususally just clear and reload the listview control after each add or delete.
-
Jun 1st, 2008, 12:54 PM
#4
Thread Starter
Hyperactive Member
Re: Refresh ListView With APIs
What APIs does Visual Basic use when I do something like ListView1.Refresh or is Edgemeal's code it? Thank you
Last edited by abazabam; Jun 1st, 2008 at 12:57 PM.
-
Jun 2nd, 2008, 04:03 AM
#5
Re: Refresh ListView With APIs
I doubt if any API's are used at all by VB for ListView1.Refresh, as it already has a direct link with the control - so can just pass a message directly (by calling the .Refresh routine that the control exposes).
I would expect Edgemeal's Redraw routine to do the same thing, but slightly less efficiently, as the message needs to be passed to Windows first, then back to the control (via any items which are hooking into the controls message queue).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|