public static string SafePathGetArgs(string path) { try { return Api_Shlwapi.PathGetArgs(path); } catch (System.Exception) { } return string.Empty; }
uint dwFlags); /* Reserved */ public static string PathCompactPathEx(string source, uint maxChars) { StringBuilder pszOut = new StringBuilder((int)Api_Shlwapi.MAX_PATH); StringBuilder pszSrc = new StringBuilder(source); int result = Api_Shlwapi.PathCompactPathEx(pszOut, pszSrc, maxChars, (uint)0); if (result == 1) return pszOut.ToString(); else { System.Diagnostics.Debug.WriteLine("Win32.PathCompactPathEx failed to compact the path '" + source + "' down to '" + maxChars + "' characters."); return string.Empty; } }