DelMultiSelect



Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Public Const LB_SETSEL = &H185&
'_________________________________________________________


'add this code to the form load to fill a list with

'some (15) of the system's screen fonts.

Sub Form_Load()
Dim i As Integer
Dim max As Integer
max = Screen.FontCount
If max > 15 Then max = 15
For i = 1 To max
List1.AddItem Screen.Fonts(i)
Next
End Sub
'_________________________________________________________


Private Sub cmdClear_Click()
Dim r As Long
r = SendMessageLong(List1.hwnd, LB_SETSEL, False, -1)
End Sub
'_________________________________________________________


Private Sub cmdSelAll_Click()
Dim r As Long
r = SendMessageLong(List1.hwnd, LB_SETSEL, True, -1)
End Sub
'_________________________________________________________


'Comments

'When lParam equals -1, setting wParam to False deselects all selections,

'and setting to True selects all entries. Setting lParam to any other number

'selects or deselects the index specified, as per the wParam setting. This

'message can also be applied against a standard FileList box.


(delmultiselect.html)- by Paolo Puglisi - Modifica del 25/3/2019