by Byte Masters TEAM (4 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 21st February 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
add a list of filenames to combo box with one line of 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
Private Const CB_DIR = &H145
Private Const DDL_Files = &H8
Private Const DDL_DIRECTORY = &H10
Private Const DDL_DRIVES = &H4000
Private Const DDL_HIDDEN = &H2
Private Const DDL_ARCHIVE = &H20
'Info
'CB_DIR :
'An application sends a CB_DIR message to add a list of
'filenames to the list box of a combo box.
'Value of wParam. Specifies the attributes of the files to be added to the list box. It can be any combination of the following values:
'Value Meaning
'DDL_ARCHIVE Includes archived files.
'DDL_DIRECTORY Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
'DDL_DRIVES Includes drives. Drives are listed in the form [-x-], where x is the drive letter.
'DDL_EXCLUSIVE Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
'DDL_HIDDEN Includes hidden files.
'DDL_READONLY Includes read-only files.
'DDL_READWRITE Includes read-write files with no additional attributes.
'DDL_SYSTEM Includes system files.
Private Sub Command1_Click()
SendMessage Combo1.hwnd, CB_DIR, DDL_Files, ByVal "C:\MP3\Vocal\*.*"
End Sub