P
Paul Welter
I'm having trouble getting the api PathYetAnotherMakeUniqueName to work.
Here is what I have so far. It is not working. What am i missing?
const int MAX_PATH = 260;
[DllImport("shell32.dll", EntryPoint="PathMakeUniqueName")]
static extern int PathMakeUniqueName (
ref string pszUniqueName,
int cchMax,
string pszTemplate,
string pszLongPlate,
string pszDir
);
[DllImport("shell32.dll", EntryPoint="PathYetAnotherMakeUniqueName")]
static extern int PathYetAnotherMakeUniqueName (
ref string pszUniqueName,
string pszPath,
string pszShort,
string pszFileSpec
);
public void Test()
{
DirectoryInfo working = new DirectoryInfo(@"..\..\");
string buffer = new string(' ', MAX_PATH);
string folderSpec = working.FullName;
string name = "New Text Document.txt";
PathYetAnotherMakeUniqueName(ref buffer, folderSpec, null, name);
}
~ Paul
Here is what I have so far. It is not working. What am i missing?
const int MAX_PATH = 260;
[DllImport("shell32.dll", EntryPoint="PathMakeUniqueName")]
static extern int PathMakeUniqueName (
ref string pszUniqueName,
int cchMax,
string pszTemplate,
string pszLongPlate,
string pszDir
);
[DllImport("shell32.dll", EntryPoint="PathYetAnotherMakeUniqueName")]
static extern int PathYetAnotherMakeUniqueName (
ref string pszUniqueName,
string pszPath,
string pszShort,
string pszFileSpec
);
public void Test()
{
DirectoryInfo working = new DirectoryInfo(@"..\..\");
string buffer = new string(' ', MAX_PATH);
string folderSpec = working.FullName;
string name = "New Text Document.txt";
PathYetAnotherMakeUniqueName(ref buffer, folderSpec, null, name);
}
~ Paul