The GetShortPathName function obtains the short path form of a specified input path.
DWORD GetShortPathName(
LPCTSTR lpszLongPath, |
// points to a null-terminated path string |
LPTSTR lpszShortPath, |
// points to a buffer to receive the null-terminated short form of the path |
DWORD cchBuffer |
// specifies the size of the buffer pointed to by lpszShortPath |
); |
If the function succeeds, the return value is the length, in characters, of the string copied to lpszShortPath, not including the terminating null character.
If the function fails due to the lpszShortPath buffer being too small to contain the short path string, the return value is the size, in characters, of the short path string. You need to call the function with a short path buffer that is at least as large as the short path string.
If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.
When an application calls this function and specifies a path on a volume that does not support 8.3 aliases, the function fails with ERROR_INVALID_PARAMETER if the path is longer than 67 bytes.
The path specified by lpszLongPath does not have to be a fully qualified path or a long path. The short form may be longer than the specifed path.
If the specified path is already in its short form, there is no need for any conversion, and the function simply copies the specified path to the buffer for the short path.
You can set lpszShortPath to the same value as lpszLongPath; in other words, you can set the buffer for the short path to the address of the input path string.
You can obtain the long name of a file from the short name by calling the FindFirstFile function.
GetFullPathName, FindFirstFile
Code:
file: /Techref/os/win/api/win32/func/src/f39_1.htm, 3KB, , updated: 2007/8/22 21:14, local time: 2024/11/3 06:29,
3.142.124.83:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/os/win/api/win32/func/src/f39_1.htm"> GetShortPathName</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.