|
-
Feb 19th, 2001, 09:44 PM
#1
Thread Starter
PowerPoster
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
-
Feb 19th, 2001, 10:21 PM
#2
Member
I did notice that you left out the Alias, but that proved irrelevant. I am getting the same error.
Have you thought about using CurDir([Drive]) Function?
It accomplishes pretty much the same thing.
Regards
-
Feb 19th, 2001, 10:23 PM
#3
Thread Starter
PowerPoster
yeah, I'm just trying to sharpen my API skills that I dont have yet..
-
Feb 19th, 2001, 10:36 PM
#4
Fanatic Member
what's up Lethal,
Try this declaration instead ......
Code:
Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectoryA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
should work fine now.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Feb 19th, 2001, 10:47 PM
#5
Thread Starter
PowerPoster
Young Buck, you da man. , that code was giving me fits, thanks again.
-
Feb 19th, 2001, 10:52 PM
#6
Fanatic Member
No problem Lethal goto www.allapi.net and download their API viewer, you can't trust the VB API Loader, alot of the declarations are wrong.
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|