Question on FILEDESCRIPTOR Structure  
Author Message
CPPUSer7





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Hello All,

I have been having some problems with the length of "file path + filename" greater than a certain number of characters (242 characters).

The problem is occuring in the drag and drop operation. FILEDESCRIPTOR structure is used to describe the properties of a file that is being copied by means of the clipboard. I see that the MAX_PATH defined is 260 characters.

I would like to find out if somebody encountered this situation and is there any function or property related to FILEDESCRIPTOR structure which can understand this path without any problems.

Thanks,
CPPUser7.


Visual C++3  
 
 
nobugz





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Please describe your problem.



 
 
Peter Ritchie





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

It's not clear what your problem is; but, the directory portion of a path cannot more than 248 characters on Windows. A path with the filename and extension cannot be more than 260 characters.

 
 
Newbee1





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Hello Peter,

Thanks for your response,

To be more clear, my question is

I am using FILEDESCRIPTOR Structure to describe files and folders on the clipboard. This structure only allows for file paths up to MAX_PATH characters. If the total length of path + filename exceeds 242 characters, operations like drag and drop are failing. Does anyone know of any format in win 32 API, which supports longers file paths.


From your response, I understood that "A path with the filename and extension cannot be more than 260 characters" using FILEDESCRIPTOR structure. Does that mean there is no other format which supports more than 260 characters and it is a limitation in Windows OS

Thanks for your time.

 
 
Peter Ritchie





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Even if there were another format to support filenames longer than MAX_PATH you wouldn't be able to use the path. Windows does not support paths longer than MAX_PATH.

 
 
CPPUSer7





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Hello Peter,

Thanks for answer, so if we have paths longer than 260 characters, we have to somehow truncate them to fit into 260 charecters. I mean in windows I see longer folder names like "Program Files" are shown something like "Program~".

Thanks

 
 
Peter Ritchie





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Hello Peter,

Thanks for answer, so if we have paths longer than 260 characters, we have to somehow truncate them to fit into 260 charecters. I mean in windows I see longer folder names like "Program Files" are shown something like "Program~".

Thanks
You can use the Platform SDK function GetPathShortName...

 
 
nobugz





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Windows actually allows path names of up to about 32,000 characters by prefixing the name with \\ \. You'll find it documented in the "Maximum Path Length" section of this MSDN article. I have never tried it and don't know how well the CLR supports it. Obscure stuff...


 
 
CPPUSer7





PostPosted: Visual C++ Language, Question on FILEDESCRIPTOR Structure Top

Thanks Peter and nobugz for the information. I will try these.