[b]GetLongPathName[/b]
The GetLongPathName function converts the specified path to its long form. If no long path is found, this function simply returns the specified name.
DWORD GetLongPathName(
LPCTSTR lpszShortPath, // file name
LPTSTR lpszLongPath, // path buffer
DWORD cchBuffer // size of path buffer
);
Parameters
lpszShortPath
[in] Pointer to a null-terminated path to be converted.
Windows 2000/XP: In the
ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the
Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.
Windows 98/Me: This string must not exceed MAX_PATH characters.
lpszLongPath
[out] Pointer to the buffer to receive the long path. You can use the same buffer you used for the lpszShortPath parameter.
cchBuffer
[in] Specifies the size of the buffer, in TCHARs.
Return Values
If the function succeeds, the return value is the length of the string copied to the lpszLongPath parameter, in TCHARs. This length does not include the terminating null character.
If the lpszLongPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, required to hold the path. Therefore, if the return value is greater than cchBuffer, call the function again with a buffer that is large enough to hold the path.
If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.
Remarks
Windows 98/Me: GetLongPathNameW is supported by the Microsoft Layer for
Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for
Unicode on Windows 95/98/Me Systems.
Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Included in Windows 98 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Unicode: Implemented as
Unicode and
ANSI versions on Windows 2000/XP. Also supported by Microsoft Layer for
Unicode.