Drive Select Dialog Box

Description

The following script displays a list of disk drives on your computer.

'Date Created: 19-Feb-2004 09:57:01 PM
'Last Updated: 19-Feb-2004 09:57:01 PM
'Created By : Jerry Brightbill
'Updated By : Jerry Brightbill
dim shared v_drives[20] as P
dim v_drive as C
v_d_list = alltrim( stritran(file.drives_get(),chr(92), crlf() ) )
v_drives.initialize_properties("Letter|display",v_d_list)
last_d = v_drives.first_empty()-1
for i = 1 to last_d
    v_drives[i].letter = upper( alltrim(v_drives[i].letter) )
    d_type = file.drive_type(v_drives[i].letter)
    if d_type = "No Root Dir"
        d_type = "Fixed"
    end if
    select
        case d_type = "Removable"
            v_drives[i].full = v_drives[i].letter+" ("+d_type+")*"+"$a5_disk_drive"
        case d_type = "Fixed"
            v_drives[i].full = v_drives[i].letter+" ("+d_type+")*"+"$a5_hard_drive"
        case d_type = "CD-Rom"
            v_drives[i].full = v_drives[i].letter+" ("+d_type+")*"+"$a5_cdrom_drive"
        case d_type = "Remote"
            v_drives[i].full = v_drives[i].letter+" ("+d_type+")*"+"$a5_network_drive"
        case .T.
            v_drives[i].full = v_drives[i].letter+" ("+d_type+")*"+"$5_hard_drive"
    end select
    if v_drive = "" .and. d_type = "Fixed"
        v_drive = v_drives[i].letter
    end if
next
DIM v_drive as C
DIM a_v_drive[4] as C
ui_dlg_box("Drives",<<%dlg%
{region}
[%O={I=:$(*)+1} {@1,$(*)-1}%.25,8v_drive^#v_drives[\].full];
{endregion};
{line=1,0};
{region}
<*15OK!OK>
{endregion};
%dlg%)
ui_msg_box("Selected Drive", left(v_drive,1) )

Thanks To: Jerry Brightbill