With VB6, is it possible to use LVS_EX_DOUBLEBUFFER to make the common control ListView flicker free? This property is exposed in VB.NET, but not VB6. I will be using version 6 of common controls, so in theory it should work. However I do not know how to implement it.
A:
You could try the free VB6 replacement for the ListView from vbAccelerator. It supports LVS_EX_DOUBLEBUFFER
Alternatively use a manifest to use Common Controls 6 in your VB6. Then in the Form_Load send the LVS_EX_DOUBLEBUFFER
message to the ListView. Something like this (based on a .NET sample). Warning - air code!
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
Const LVM_FIRST = &H1000
Const LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54)
Const LVM_GETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 55)
Const LVS_EX_DOUBLEBUFFER = &H10000
Const LVS_EX_BORDERSELECT = &H8000
Private Sub FormLoad()
Dim styles As Long
styles = SendMessage(listView.hwnd, _
LVM_GETEXTENDEDLISTVIEWSTYLE, 0, ByVal 0&)
styles = Style Or LVS_EX_DOUBLEBUFFER Or LVS_EX_BORDERSELECT
Call SendMessage(listView.hwnd, _
LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal styles)
End Sub
MarkJ
2009-08-17 08:49:23