[fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

James Richters james.richters at productionautomation.net
Fri Jun 18 23:50:32 CEST 2021


I'm converting my AnsiString to a Pchar with 
TFileName.lpstrFile:=Pchar(DefaultFileName);
 
But I didn't understand the meaning of 
TFileName.nMaxFile:=100;  I thought it was the maximum number of files to
display or something.. not the maximum number of characters in the file
name. which it appears to be.
 
So now I have:
TFileName.nMaxFile:= Length(DefaultFileName)+1; 
TFileName.lpstrFile:=Pchar(DefaultFileName);
 
I need the +1 for the #0 at the end of the Pchar,  and now it works fine,
and I can have strings as long as they need to be.
 
Thank you for the help!
 
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210618/5d76b188/attachment-0001.htm>


More information about the fpc-pascal mailing list