'' ドライブ調査用 ''' 判断不能 Public Const DRIVE_NODETERMINE_DRIVETYPE As Long = 0 ''' ルートディレクトリなし Public Const DRIVE_NOEXIST_ROOTDIRECTORY As Long = 1 ''' 取り外し可能 Public Const DRIVE_REMOVABLE As Long = 2 ''' 固定 Public Const DRIVE_FIXED As Long = 3 ''' ネットワーク Public Const DRIVE_REMOTE As Long = 4 ''' CD-ROM Public Const DRIVE_CDROM As Long = 5 ''' RAMディスク Public Const DRIVE_RAMDISK As Long = 6 Private Declare Function GetLogicalDriveStrings Lib "kernel32.dll" _ Alias "GetLogicalDriveStringsA" _ (ByVal nBufferLength As Long, _ ByVal lpBuffer As String) As Long Private Declare Function GetDriveType Lib "kernel32" _ Alias "GetDriveTypeA" _ (ByVal nDrive As String) As Long ' @(f) ' ' 機能 : ドライブ 取得 ' ' 返り値 : ドライブの文字の配列 (異常時は Null) ' ' 機能説明 : ドライブを取得しVariant配列にして返す。 ' ' 備考 : ' Public Function pGetDrives() As Variant Dim strBuffer As String * 256 Dim strDrives As String Call GetLogicalDriveStrings(Len(strBuffer), strBuffer) strDrives = pGetStringFromAPI(strBuffer, String$(2, vbNullChar)) If strDrives = vbNullChar Or strDrives = "" Then pGetDrives = Null Else pGetDrives = Split(strDrives, vbNullChar) End If End Function ' @(f) ' ' 機能 : ドライブ種類取得 ' ' 返り値 : ドライブの種類 (上記 Public Const 参照) ' ' 機能説明 : ドライブの種類を返す。 ' ' 備考 : ' Public Function pGetDriveType(ByVal strDrive As String) pGetDriveType = GetDriveType(strDrive) End Function ' @(f) ' ' 機能   : APIの引数からの文字列取得 ' ' 返り値  : 取得した文字列 ' ' 引き数  : ARG1 - APIの引数の文字列 ' ARG2 - 終端の文字 ... 既定値 vbNullChar ' ' 機能説明 : APIの引数で使用される文字列(Null文字が終端の固定長)から ' Accessで使用する文字列(可変長)を取得する ' ' 備考   : ' Public Function pGetStringFromAPI(strApiString As String, _ Optional ByVal strEndChar As String = vbNullChar) As String Dim intPos As Integer intPos = InStr(1, strApiString, strEndChar) If intPos > 0 Then pGetStringFromAPI = Left(strApiString, intPos - 1) Else pGetStringFromAPI = strApiString End If End Function