Desktop Functions: Smart Device Functions:
|
Search Results for "folder" in kernel32
VolumeFunctions.DefineDosDevice(0, @"Y:", @"c:\test\folder\name\");
// Delete a virtual drive. The drive letter and folder must match.
@"C:\test\folder\name");
//You need to be able to hold up to 32767 chars if you plan to recurse deep folder structures uint folderNameLength = GetCurrentDirectory(MAX_DEEP_PATH, nameBuffer); if (folderNameLength == 0) if (folderNameLength > MAX_DEEP_PATH)
Console.WriteLine("Failed to get initial working directory; allocated buffer is shorter than required: '{0}'<'{1}'", MAX_DEEP_PATH, folderNameLength);
/// <param name="folderName">Directory or unc folder name of the volume to
public static bool DriveFreeBytes(string folderName, out ulong freespace)
if (string.IsNullOrEmpty(folderName))
throw new ArgumentNullException("folderName");
if (!folderName.EndsWith("\\"))
folderName += '\\';
if (GetDiskFreeSpaceEx(folderName, out free, out dummy1, out dummy2))
/// <param name="folderName">Directory or unc folder name of the volume to
public static bool DriveFreeBytes(string folderName, out ulong freespace)
if (string.IsNullOrEmpty(folderName))
throw new ArgumentNullException("folderName");
if (!folderName.EndsWith("\\"))
folderName += '\\';
if (GetDiskFreeSpaceEx(folderName, out free, out dummy1, out dummy2)) System.Environment.GetFolderPath( ... ) As String
/// The GetTempFileName and GetTempFolderName methods (and overloads) provide
/// support for folders), but provide access to the Win32 functionality of providing
/// an optional prefix, unique suffix and base folder name, as well as the Win32
/// functionality of creating the temp file or folder as soon as the name is generated.
public static string GetTempFolderName() {
return GetTempFolderName("tmp");
public static string GetTempFolderName(string prefix) {
return GetTempFolderName(prefix, 0);
public static string GetTempFolderName(string prefix, uint unique) {
return GetTempFolderName(prefix, unique, Path.GetTempPath());
public static string GetTempFolderName(string prefix, uint unique, string basePath) {
string tempFolderName = GetTempFileName(prefix, unique, basePath);
// Delete created file and create folder name instead
File.Delete(tempFolderName);
Directory.CreateDirectory(tempFolderName);
return tempFolderName;
string tempFolder = Win32Utility.GetTempFolderName();
Folder.Delete(tempFolder); 7: GetTempPath
Public Function Create(ByVal astrFoldername As String, _
If (astrFoldername = "") Then
astrFoldername = tempPath.ToString
lngRet = GetTempFileName(astrFoldername, astrPrefix, 0, tempName)
Private fFoldername As String = "C:\TempFile"
Dim expected As String = fFoldername + "\" + Left(fPrefix, 3) 'Only part of the expected answer. The other part is random.
If Not Directory.Exists(fFoldername) Then
dirInfo = Directory.CreateDirectory(fFoldername)
Throw New Exception("Directory '" + fFoldername + "' can not be created")
actual = target.Create(fFoldername, fPrefix)
Assert.AreEqual(Left(expected, Len(fFoldername) + 4), Left(actual, Len(fFoldername) + 4))
Assert.AreEqual(Left(expected, Len(fFoldername) + 4), Left(actual, Len(fFoldername) + 4))
''' <param name="FolderPath">Path to drive or shared folder to find about.</param>
ByVal FolderPath As String, _
Dim sRootFolder As String = IO.Path.GetPathRoot(FolderPath)
If Not sRootFolder.EndsWith("\") Then sRootFolder &= "\"
Dim RetVal As UInt32 = GetVolumeInformation(sRootFolder, volname, volname.Capacity, _
Dim sSystemPath As String = System.Environment.GetFolderPath(Environment.SpecialFolder.System)
Dim ConfigFile As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\" & MYNAME & "\" & "database.config" |