I'm getting this error:
"Can't find DLL Entry Point GetCurrentDirectory in Kernel32
Anyone know why, here's my code
Code:'Option Explicit Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long Private Declare Function GetCurrentDirectory Lib "kernel32" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Const DRIVE_CDROM = 5 Const DRIVE_FIXED = 3 Const DRIVE_RAMDISK = 6 Const DRIVE_REMOTE = 4 Const DRIVE_REMOVABLE = 2 Private Sub cmdExit_Click() End End Sub Private Sub Drive1_Change() 'Dim driveType As Long 'Dim freeSpace As Long, Sectors As Long 'Dim Bytes As Long 'Dim freeClusters As Long, totalClusters As Long 'Dim retValue As Long 'Dim buffer As String * 255 'Dim DName As String Screen.MousePointer = vbHourglass DoEvents DName = Left(Drive1.Drive, 2) & "\" driveType = GetDriveType(DName) Select Case driveType Case 0 lblDrive = "UNDETERMINED" Case DRIVE_REMOVABLE lblDrive = "REMOVABLE" Case DRIVE_FIXED lblDrive = "FIXED" Case DRIVE_REMOTE lblDrive = "REMOTE" Case DRIVE_CDROM lblDrive = "CDROM" Case DRIVE_RAMDISK lblDrive = "RAMDISK" End Select ' Get free space retValue = GetDiskFreeSpace(DName, Sectors, Bytes, freeClusters, totalClusters) lblFreeDiskSpace = Sectors * Bytes * freeClusters ' Get current directory retValue = GetCurrentDirectory(255, buffer) lblCurrentDir = buffer ' Get windows directory retValue = GetWindowsDirectory(buffer, 255) lblWindowsDir = buffer Screen.MousePointer = vbDefault DoEvents Debug.Print App.Path End Sub Private Sub Form_Load() Drive1_Change End Sub




Reply With Quote