GetFullPathName Function

Declare Function GetFullPathName Lib "kernel32.dll" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long

GetFullPathName appends a specified filename to the name of the current directory. For example, if you specify the file "hello.txt" and the current directory is "C:\My Documents\Junk", the resulting filename would be "C:\My Documents\Junk\hello.txt". This string is put into the string passed as lpBuffer. The function returns 0 if an error occured, or the length of the final string if successful.

lpFileName
The name of the file to append.
nBufferLength
The size in characters of lpBuffer.
lpBuffer
A fixed-length string variabled that receives the combined path and filename.
lpFilePart
??? (appears to have no effect)

Example:

' Set current directory to C:\Windows\Media
ChDir "\Windows\Media"
' Append the filename ding.wav
Dim buffer As String * 255
x = GetFullPathName("ding.wav", 255, buffer, "")
Debug.Print Left(buffer, x)  ' should be "C:\Windows\Media\ding.wav"

Related Call: GetShortPathName
Category: Files
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/getfullpathname.html