c00000fd
c00000fd

Reputation: 22255

Can I make GetOpenFileName return paths longer than MAX_PATH?

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:

enter image description here

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

Answers (1)

David Heffernan
David Heffernan

Reputation: 612794

Windows file dialogs, even the new Vista IFileDialog, will not return file names longer than MAX_PATH.

Upvotes: 5

Related Questions