(also posted in microsoft.public.vb.syntax ng)

When the following code is executed, the combobox that's supposed to be
populated with drive letters of *only* local or network drives, also
contains removable; ie: Zip and floppy, and CD-ROM drive letters. However,
if I run the same code specifiying DRIVE_REMOVABLE as the 2nd argument to
GetDriveList(), the combobox only contains the drive letters of floppy and
Zip drives, which I would expect. See note below, perhaps the problem lies
there but I can't see it, perhaps I've been looking at too long <g>.

'-- drive types returned by GetDriveType() API function
Const DRIVE_REMOVABLE = 2
Const DRIVE_FIXED = 3
Const DRIVE_REMOTE = 4
Const DRIVE_CDROM = 5
Const DRIVE_RAMDISK = 6

'-- API declarations
Declare Function GetLogicalDriveStrings _
Lib "kernel32" _
Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) _
As Long

Declare Function GetDriveType _
Lib "kernel32" _
Alias "GetDriveTypeA" _
(ByVal sDrive As String) _
As Long

'-- populate combobox with drive letters of fixed or network drives *only*
GetDriveList Me.cboTargetDrives, DRIVE_FIXED Or DRIVE_REMOTE

Private Sub GetDriveList(Cbo As ComboBox, DriveTypes As Long)

Dim sDrives As String * 255
Dim lResult As Long
Dim lUBound As Long
Dim lEle As Long
Dim lDriveType As Long

'-- retrieve a null-separated string of drive letters
lResult = GetLogicalDriveStrings(Len(sDrives), sDrives)

'-- if API call returned something...
If (lResult > 0) Then

'-- clear the combobox item list
Cbo.Clear

'-- retain only what is significant
sDrives = Mid$(UCase$(sDrives), 1, lResult)

'-- flush and repopulate module-level array
ReDim m_aDrives(0)
m_aDrives = Split(Trim$(sDrives), Chr$(0))

'-- get the upper bound of m_aDrives(), minus one
' because the last element will be empty
lUBound = (UBound(m_aDrives) - 1)

'-- iterate through each element of m_aDrives()
For lEle = 0 To lUBound

'-- call API function to determine each drive type
lDriveType = GetDriveType(Trim$(m_aDrives(lEle)))

'*************************************
'-- NOTE: I think this is where the problem is!
'*************************************
If (DriveTypes And lDriveType) = lDriveType Then

'-- add it to the list of items in the combobox,
' stripping the trailing backslash character
Cbo.AddItem Mid$(m_aDrives(lEle), 1, 2)

End If

Next lEle

End If

End Sub