Option Compare Database Option Explicit '------------------------------------------ 'ファイルシステムとボリューム情報を取得する '戻り値 正常終了 = 0以外 ' エラー = 0 '------------------------------------------ Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" _ (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, _ ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _ lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _ ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long '------------------------------------------------------------- 'ボリュームラベルを設定する '戻り値 正常終了 = 0以外 ' エラー = 0 'Widows95ではlpVolumeNameにvbNullStringを指定すると失敗します '------------------------------------------------------------- Declare Function SetVolumeLabel Lib "kernel32" Alias "SetVolumeLabelA" (ByVal lpRootPathName As String, ByVal lpVolumeName As String) As Long 'Windowsディレクトリを取得 Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long 'Windowsディレクトリを取得 Function LsGetWindowsDirectory() As String Dim Gwdvar As String, Gwdvar_Length As Long Gwdvar = Space(255) Gwdvar_Length = GetWindowsDirectory(lpBuffer:=Gwdvar, nSize:=255) '2002/10/09 Bug Fix 'LsGetWindowsDirectory = Trim$(Left$(Gwdvar, Gwdvar_Length)) LsGetWindowsDirectory = LsNullTrim(Gwdvar) End Function '文字列の最初の vbNullChar[chr$(0)] までを抜き出す Public Function LsNullTrim(strExp As String) As String Dim i As Integer i = InStr(strExp, vbNullChar) If i > 0 Then LsNullTrim = Left$(strExp, i - 1) Else LsNullTrim = strExp End If End Function