[python-win32] win32ui.CreateFileDialog error
Tim Roberts
timr at probo.com
Thu Aug 10 19:19:03 CEST 2006
Tim Roberts wrote:
>Tim Riley wrote:
>
>
>>Can anyone explain to me why the following code will return a list if
>>I select 12 files but will return None if I select 13?
>>
>>
>
>It's an ugly but well-known limitation: the buffer passed to
>CreateFileDialog is big, but not big enough. When you select more files
>than will fit, the API returns an error, and the wrapper returns that
>error instead of reallocating and retrying.
>
Allow me to apologize to pywin32. The problem is not in the pywin32
wrapper, the problem is in MFC. Pywin32 uses the MFC CFileDialog class,
and that class has a hard-coded 256-byte buffer for the file names.
Pywin32 cannot "reallocate and retry"; the interface is simply not exposed.
Roger Upole's advice is the best: use win32gui.GetOpenFileNameW. It's
not quite as friendly, but it doesn't have the same limitation.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list