Vous pouvez essayer la version courte du chemin du nom de fichier à l'aide:
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetShortPathName(
[MarshalAs(UnmanagedType.LPTStr)] System.String path,
[MarshalAs(UnmanagedType.LPTStr)] System.Text.StringBuilder shortPath,
System.Int32 shortPathLength);
Ensuite, la boîte de dialogue de fichier de sauvegarde ressemblerait à quelque chose comme ceci:
string long_path = @"C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger\1033\vsdebugui.dll";
StringBuilder s = new StringBuilder(long_path.Length);
int short_path_length = GetShortPathName(long_path, s, long_path.Length);
string short_path = s.ToString();
SaveFileDialog save_d = new SaveFileDialog();
save_d.FileName = short_path;
save_d.ShowDialog();
Avec "nomfichier", voulez-vous dire le nom complet, y compris son chemin ou juste le nom par rapport à son dossier parent? – MSalters