Quote:
|
Originally Posted by MSDN
nMaxFile
Specifies the size, in TCHARs, of the buffer pointed to by lpstrFile. For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters. The buffer must be large enough to store the path and file name string or strings, including the terminating NULL character. The GetOpenFileName and GetSaveFileName functions return FALSE if the buffer is too small to contain the file information. The buffer should be at least 256 characters long.
|
Why in the world use 21000? It says at least 256, but the MAX_PATH (on Windows XP) is 260. Why not make it that.
Or why not increase the size of the buffer (using the keyword new) while the GetOpenFileName function returns FALSE. You will have to check what error returns, you can do so with the
CommDlgExtendedError function, you are looking for the FNERR_BUFFERTOOSMALL error code.