/// <summary> /// Get a root drive name /// </summary> public static string GetDriveName(string rootPathName) { uint uiSerialNumber, uiSysFlags; string szFileSystem; string szDriveName = Win32ApiUtility.GetDriveInformations(rootPathName, out uiSerialNumber, out uiSysFlags, out szFileSystem); return(szDriveName); }
public static bool CaptureWindow(Control destinationObject, ref System.Drawing.Bitmap destinationBitmap) { if (destinationObject == null) { throw new NolmeArgumentNullException(); } //This function captures the contents of a window or control Graphics g2 = Graphics.FromImage(destinationBitmap); //PrfCHILDREN // PrfNONCLIENT int meint = (int)(Prints.Client | Prints.EraseBackground); //| Owned ); // ); System.IntPtr meptr = new System.IntPtr(meint); System.IntPtr hdc = g2.GetHdc(); Win32ApiUtility.SendMessage(new HandleRef(destinationObject, destinationObject.Handle), WindowsMessage.Print, (int)hdc, (int)meptr); g2.ReleaseHdc(hdc); g2.Dispose(); return(true); }
/// <summary> /// Get a root drive name /// </summary> public static string GetDriveInformations(string rootPathName, out uint serialNumber, out DriveInformations driveInformations, out string fileSystem) { uint uiSysFlags; string szDriveName = Win32ApiUtility.GetDriveInformations(rootPathName, out serialNumber, out uiSysFlags, out fileSystem); driveInformations = 0; if (szDriveName.Length != 0) { // Convert flags if ((uiSysFlags & (uint)DriveInformations.CaseSensitiveSearch) == (uint)DriveInformations.CaseSensitiveSearch) { driveInformations |= DriveInformations.CaseSensitiveSearch; } if ((uiSysFlags & (uint)DriveInformations.CasePreservedNames) == (uint)DriveInformations.CasePreservedNames) { driveInformations |= DriveInformations.CasePreservedNames; } if ((uiSysFlags & (uint)DriveInformations.UnicodeOnDisk) == (uint)DriveInformations.UnicodeOnDisk) { driveInformations |= DriveInformations.UnicodeOnDisk; } if ((uiSysFlags & (uint)DriveInformations.PersistentAcls) == (uint)DriveInformations.PersistentAcls) { driveInformations |= DriveInformations.PersistentAcls; } if ((uiSysFlags & (uint)DriveInformations.FileCompression) == (uint)DriveInformations.FileCompression) { driveInformations |= DriveInformations.FileCompression; } if ((uiSysFlags & (uint)DriveInformations.VolumeQuotas) == (uint)DriveInformations.VolumeQuotas) { driveInformations |= DriveInformations.VolumeQuotas; } if ((uiSysFlags & (uint)DriveInformations.SparseFiles) == (uint)DriveInformations.SparseFiles) { driveInformations |= DriveInformations.SparseFiles; } if ((uiSysFlags & (uint)DriveInformations.ReparsePoints) == (uint)DriveInformations.ReparsePoints) { driveInformations |= DriveInformations.ReparsePoints; } if ((uiSysFlags & (uint)DriveInformations.RemoteStorage) == (uint)DriveInformations.RemoteStorage) { driveInformations |= DriveInformations.RemoteStorage; } if ((uiSysFlags & (uint)DriveInformations.VolumeIsCompressed) == (uint)DriveInformations.VolumeIsCompressed) { driveInformations |= DriveInformations.VolumeIsCompressed; } if ((uiSysFlags & (uint)DriveInformations.SupportObjectsIds) == (uint)DriveInformations.SupportObjectsIds) { driveInformations |= DriveInformations.SupportObjectsIds; } if ((uiSysFlags & (uint)DriveInformations.SupportEncryption) == (uint)DriveInformations.SupportEncryption) { driveInformations |= DriveInformations.SupportEncryption; } if ((uiSysFlags & (uint)DriveInformations.NamedStreams) == (uint)DriveInformations.NamedStreams) { driveInformations |= DriveInformations.NamedStreams; } if ((uiSysFlags & (uint)DriveInformations.ReadOnlyVolume) == (uint)DriveInformations.ReadOnlyVolume) { driveInformations |= DriveInformations.ReadOnlyVolume; } } return(szDriveName); }