Reputation: 22255
I'm using the GetOpenFileName API, or in my case MFC's CFileDialog to open files, pretty much like it's shown here (except for a single file selection -- i.e. I provided my own longer buffer in m_ofn.lpstrFile
.)
It works fine, except when a user picks a file whose path becomes longer than MAX_PATH - 1
(or 259) characters. In that case the following happens:
On my Windows 8.1, it converts the user selected path into an archaic 8.3 short file format: "C:\TESTDE~1\NEWFOL~1"
On Windows XP I can't even select anything, I get this:
So I'm curious, since the OS itself supports long Unicode paths, prefixed with \\?\
(including XP) is there any way to coax GetOpenFileName to return paths in that format as well and not be limited by 259 characters?
Upvotes: 6
Views: 721
Reputation: 612794
Windows file dialogs, even the new Vista IFileDialog
, will not return file names longer than MAX_PATH
.
Upvotes: 5