Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems


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

Platforms: Win 32s, Win 95/98, Win NT

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 string variabled that receives the null-terminated combined path and filename.
lpFilePart
??? (appears to have no effect)

Example:

' Append the filename datafile.dat to C:\Programs\Test Dim buffer As String ' receives path and filename string Dim numchar As Long ' receives length of buffer after function call ChDir "\Programs\Test" ' change current directory to C:\Programs\Test buffer = Space(255) ' make room for buffer to receive the string numchar = GetFullPathName("datafile.dat", 255, buffer, "") ' put the result string into buffer buffer = Left(buffer, numchar) ' extract data from the returned string Debug.Print buffer ' display resulting string

See Also: GetShortPathName Category: Files

Go back to the alphabetical Function listing. Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information. Go back to the Windows API Guide home page. E-mail: vbapi@vbapi.com Send Encrypted E-Mail This page is at http://www.vbapi.com/ref/g/getfullpathname.html

Категории