Is there a 2048 character limit for OFN_ALLOWMULTISELECT in MFC or isn't there?

Raymond Chen

The MFC documentation for CFile­Dialog contains the following strange warning:

When the user allocates their own buffer to accommodate OFN_ALLOW­MULTI­SELECT, the buffer can’t be larger than 2048 or else everything gets corrupted (2048 is the maximum size).

The sudden informality of the phrase “or else everything gets corrupted” is surprising but also sounds vaguely familiar to me. I think I was the one who wrote that phrase over a decade ago as part of my investigation into a defect in the common dialog functions. Somebody must have forwarded my analysis to the MFC documentation team (since the problem was originally in an MFC application), who just copied and pasted it into the official documentation. The limitation in question existed in Windows 95 and was fixed in Windows NT 4 and Windows 98, so the remarks do not apply to any modern version of Windows. What struck me is that the MFC documentation picked up this limitation rather than deferring to the Platform SDK team to document the issue. It means that when the bug is fixed in the platform, the MFC documentation becomes wrong.

The limitation is not mentioned in the Visual Studio 2008 version of the CFile­Dialog documentation, which suggests either that the Visual Studio folks deferred documenting the issue to the Platform SDK team, or they somehow figured out that the issue no longer applied and removed the offending text.


Discussion is closed.

Feedback usabilla icon