protected virtual Boolean Set(String key, String value, String section) { if (WritePrivateProfileString(section, key, value, Path) == 0) { InteropUtils.ThrowLastWin32Exception(); } return(true); }
public static DiskSpace DriveFreeBytes(String path) { if (String.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (!path.EndsWith("\\")) { path += '\\'; } if (!GetDiskFreeSpaceEx(path, out UInt64 free, out UInt64 total, out UInt64 totalfree)) { InteropUtils.ThrowLastWin32Exception(); } return(new DiskSpace(path, total, totalfree, free)); }
public static MonitorInfo GetMonitorInfoFromWindow(IntPtr handle, DefaultMonitorType type) { if (handle == IntPtr.Zero) { throw new ArgumentNullException(nameof(handle)); } IntPtr monitor = MonitorFromWindow(handle, (UInt32)type); if (monitor == IntPtr.Zero) { InteropUtils.ThrowLastWin32Exception(); } MonitorInfo screen = new MonitorInfo(); if (!GetMonitorInfo(monitor, screen)) { InteropUtils.ThrowLastWin32Exception(); } return(screen); }