|
|
|
|
|
Dicas
|
|
Visual Basic (Drives/CD-ROM/Discos)
|
|
|
Título da Dica: Lista todos os drives do micro e informa se é CD-Rom, Disco fixo....
|
|
|
|
Postada em 1/10/2003 por Tekki
'No módulo : Public Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" _ (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _ (ByVal nDrive As String) As Long
'No Form 'Form_Activate 'Não use no load
Dim sDriveCD As String Dim sCD allDrives$ = Space$(64) Form1.Cls ret& = GetLogicalDriveStrings(Len(allDrives$), allDrives$) allDrives$ = Left$(allDrives$, ret&) Do pos% = InStr(allDrives$, Chr$(0)) If pos% Then JustOneDrive$ = Left$(allDrives$, pos% - 1) allDrives$ = Mid$(allDrives$, pos% + 1, Len(allDrives$)) DriveType& = GetDriveType(JustOneDrive$) If DriveType& = 2 Then Print UCase$(JustOneDrive$) & " Unidade de Disco Removível" sDriveCD = UCase$(JustOneDrive$) ElseIf DriveType& = 3 Then Print UCase$(JustOneDrive$) & " Unidade de Disco Fixo" sDriveCD = UCase$(JustOneDrive$) ElseIf DriveType& = 4 Then Print UCase$(JustOneDrive$) & " Unidade de Drive Remoto" sDriveCD = UCase$(JustOneDrive$) ElseIf DriveType& = 5 Then Print UCase$(JustOneDrive$) & " Unidade de CD-Rom" sDriveCD = UCase$(JustOneDrive$) ElseIf DriveType& = 6 Then Print UCase$(JustOneDrive$) & " Ramdisk" sDriveCD = UCase$(JustOneDrive$) Else Print UCase$(JustOneDrive$) & " ????" End If End If Loop Until allDrives$ = ""
|
|
|
|
|