home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / gettin1r / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-21  |  2.6 KB  |  81 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Find CD"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4650
  9.    BeginProperty Font 
  10.       Name            =   "Arial"
  11.       Size            =   9.75
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    LinkTopic       =   "Form1"
  19.    ScaleHeight     =   3195
  20.    ScaleWidth      =   4650
  21.    StartUpPosition =   3  'Windows Default
  22.    Begin VB.CommandButton Command1 
  23.       Caption         =   "Command1"
  24.       BeginProperty Font 
  25.          Name            =   "MS Sans Serif"
  26.          Size            =   8.25
  27.          Charset         =   0
  28.          Weight          =   400
  29.          Underline       =   0   'False
  30.          Italic          =   0   'False
  31.          Strikethrough   =   0   'False
  32.       EndProperty
  33.       Height          =   495
  34.       Left            =   3360
  35.       TabIndex        =   0
  36.       Top             =   2640
  37.       Width           =   1215
  38.    End
  39. Attribute VB_Name = "Form1"
  40. Attribute VB_GlobalNameSpace = False
  41. Attribute VB_Creatable = False
  42. Attribute VB_PredeclaredId = True
  43. Attribute VB_Exposed = False
  44. Private Sub Command1_Click()
  45. allDrives$ = Space$(64)
  46.        
  47. Form1.Cls   'clear form of lettering
  48. ret& = GetLogicalDriveStrings(Len(allDrives$), allDrives$)
  49. 'trim off any trailing spaces. AllDrives$
  50. 'now contains all the drive letters.
  51. allDrives$ = Left$(allDrives$, ret&)
  52.    'first check that there is a chr$(0) in the string
  53.    pos% = InStr(allDrives$, Chr$(0))
  54.    'if there's one, then...
  55.      If pos% Then
  56.      'extract the drive up to the chr$(0)
  57.      JustOneDrive$ = Left$(allDrives$, pos% - 1)
  58.                
  59.      'and remove that from the Alldrives string,
  60.      'so it won't be checked again
  61.      allDrives$ = Mid$(allDrives$, pos% + 1, Len(allDrives$))
  62.                
  63.      'with the one drive, call the API to
  64.      'determine the drive type
  65.      DriveType& = GetDriveType(JustOneDrive$)
  66.      'check if it's what we want
  67.              If DriveType& = 5 Then 'then it is a CD Drive
  68.                 Print UCase$(JustOneDrive$) & " is a CD Drive"
  69.              Else
  70.                 Print UCase$(JustOneDrive$) & " is NOT a CD Drive"
  71.              End If
  72.      End If
  73. Loop Until allDrives$ = ""
  74. End Sub
  75. Private Sub Command2_Click()
  76. End Sub
  77. Private Sub Form_Load()
  78.        Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
  79.        
  80.    End Sub
  81.