View Single Post
Old Mar 10th, 2006, 9:00 AM   #2
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
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.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote