Se que es posible, pero no lo encuentro.
Ayuda plis ^_^
Gracias.

| |||
![]() Buenas, queria hacer un DriveListBox pero con un Combobox, para utilizar los Selectedintems y eso. Me explico? Se que es posible, pero no lo encuentro. Ayuda plis ^_^ Gracias. ![]() |
| |||
hola usa esta api GetLogicalDriveStrings buscalo en esta web http://www.mentalis.org/apilist/apilist.php |
| |||
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Sub Form_Load() Dim strSave As String strSave = String(255, Chr$(0)) ret& = GetLogicalDriveStrings(255, strSave) For keer = 1 To 100 If Left$(strSave, InStr(1, strSave, Chr$(0))) = Chr$(0) Then Exit For Combo1.AddItem Left$(strSave, InStr(1, strSave, Chr$(0)) - 1) strSave = Right$(strSave, Len(strSave) - InStr(1, strSave, Chr$(0))) Next keer End Sub esa es una forma o bien puedes hacerlo con un image combo y ver los iconos agrega a un formulario un imagecombo1 un imagelist1 y un picture1 luego agrea este codigo: Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long Private Sub Form_Load() With Picture1 .BackColor = vbWhite .AutoRedraw = True .Width = 540 .Height = 540 .Visible = False End With Dim strSave As String strSave = String(255, Chr$(0)) ret& = GetLogicalDriveStrings(255, strSave) 'si avilitas o midificas estas lineas cambia el tamaño de los iconos 'ImageList1.ImageHeight = 18 'ImageList1.ImageWidth = 18 ImageCombo1.Font.Bold = True ImageCombo1.Font.Size = 18 For keer = 1 To 20 Dim Disco As String If Left$(strSave, InStr(1, strSave, Chr$(0))) = Chr$(0) Then Exit For Disco = Left$(strSave, InStr(1, strSave, Chr$(0)) - 1) mIcon = ExtractAssociatedIcon(App.hInstance, Disco, 2) Picture1.Cls DrawIcon Picture1.hdc, 0, 0, mIcon DestroyIcon mIcon ImageList1.ListImages.Add Key:=Disco, Picture:=Picture1.Image Set ImageCombo1.ImageList = ImageList1 ImageCombo1.ComboItems.Add , , Disco, keer, keer strSave = Right$(strSave, Len(strSave) - InStr(1, strSave, Chr$(0))) 'no se como selecionar un items ImageCombo1.Text = Left(App.Path, 3) Next keer End Sub |