[DllImport("shell32.dll", EntryPoint="PathMakeUniqueName", CharSet=CharSet.Unicode)]
static extern bool PathMakeUniqueName (
StringBuilder pszUniqueName,
int cchMax,
string pszTemplate,
string pszLongPlate,
string pszDir);
<DllImport("shell32.dll", EntryPoint:="PathMakeUniqueName", CharSet:=CharSet.Unicode)> _
Shared Function PathMakeUniqueName( _
ByVal pszUniqueName As StringBuilder, _
ByVal cchMax As Integer, _
ByVal pszTemplate As String, _
ByVal pszLongPlate As String, _
ByVal pszDir As String) As Boolean
End Function
const int MAX_PATH = 260;
StringBuilder buffer = new StringBuilder(MAX_PATH);
string folderSpec = @"c:\";
string fileSpec = "longfilename.log";
bool result = PathMakeUniqueName(buffer, buffer.Capacity, null, fileSpec, folderSpec);
Debug.WriteLine(string.Format("File: {0}", buffer.ToString()));
Do you know one? Please contribute it!