[python-win32] large buffer with GetOpenFileNameW

Tim Roberts timr at probo.com
Thu May 24 14:10:18 EDT 2018


Andrew Ziem wrote:
> When I select a few files, the dialog works, but when I select many
> files, I get the following error. Do you have any advice?
>
> error: (12291, 'GetOpenFileNameW', 'No error message is available')
>
> Error 12291 is FNERR_BUFFERTOOSMALL

Yes.  The code in win32gui.i only allocates a buffer of 1,024
characters.  If you select more than that, you'll get FNERR_BUFFERTOOSMALL.

There may be a slimy way to work around this.  The code allocates the
larger of 1024 characters or the size of the File parameter.   You could
try something like
    win32gui.GetOpenFileName( None, File='\x00' * 2048, Flags=... )

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list