Selection of lengthy path in the open save dialog box, retunr truncated string
-
I have created the file open/save dialog box using CFile dialog. I selected the lengthy file path which is more than 512 bytes ( Jsapanese file path) the return value from the doModal() is IDOK. if I try to get the file name using the GetPathName(), it returns invalid truncated string. Please let me know any way to get whether the file path returned is truncated or how to get the correct full path. even the GetLastError() function return zero at tthis scenario. Thanks in advance sandeep
-
I have created the file open/save dialog box using CFile dialog. I selected the lengthy file path which is more than 512 bytes ( Jsapanese file path) the return value from the doModal() is IDOK. if I try to get the file name using the GetPathName(), it returns invalid truncated string. Please let me know any way to get whether the file path returned is truncated or how to get the correct full path. even the GetLastError() function return zero at tthis scenario. Thanks in advance sandeep
What is the size fo the buffer that you passed? There is a member variable in the
CFileDialog
class calledm_ofn
which is anOPENFILENAME
structure. Get hold of thelpstrFile
and pass aTCHAR
buffer that is enough to hold the file name.
Nibu thomas Software Developer
-
What is the size fo the buffer that you passed? There is a member variable in the
CFileDialog
class calledm_ofn
which is anOPENFILENAME
structure. Get hold of thelpstrFile
and pass aTCHAR
buffer that is enough to hold the file name.
Nibu thomas Software Developer
Yes I tried that by passing the maximum buffer, but still it return only truncated string. I looked into the implementation of the GetPathName() function and came to know that, it is returning only MAX_PATH. Current selected path is beyond the MAX_PATH. :(
-
Yes I tried that by passing the maximum buffer, but still it return only truncated string. I looked into the implementation of the GetPathName() function and came to know that, it is returning only MAX_PATH. Current selected path is beyond the MAX_PATH. :(
An update to my analyses is, it can return the file path upto 260 characters ( not bytes). If the selected path is beyond the 260 characters, it truncates. This scenario is possible when the folder path it self will be almost equal to 260 characters. Now if we select that folder from save as dialog to save some file, it truncates the path. Please le mt know whether I can change this to return me the full path. Thanks in advance Sandeep
-
An update to my analyses is, it can return the file path upto 260 characters ( not bytes). If the selected path is beyond the 260 characters, it truncates. This scenario is possible when the folder path it self will be almost equal to 260 characters. Now if we select that folder from save as dialog to save some file, it truncates the path. Please le mt know whether I can change this to return me the full path. Thanks in advance Sandeep
UNICODE
chars are two bytes long. So make sure you supply the required buffer for this purpose. If you are usingMAX_PATH
then use(MAX_PATH*2)
.
Nibu thomas Software Developer