public VideoCard(string ID, string Name, DisplayDeviceStateFlags StateFlags, string[] Devices, string[] RegistryKeys) { this.ID = ID ?? throw new ArgumentNullException(nameof(ID)); this.Name = Name ?? string.Empty; this.StateFlags = StateFlags; this.Devices = Devices ?? new string[0]; this.RegistryKeys = RegistryKeys ?? new string[0]; }
public void Init() { this.DeviceName = new char[32]; this.DeviceString = new char[128]; this.StateFlags = 0; this.DeviceID = new char[128]; this.DeviceKey = new char[128]; this.cb = (UInt32)Marshal.SizeOf(typeof(DISPLAY_DEVICEW)); }
public DISPLAY_DEVICE(DisplayDeviceStateFlags flags) { cb = 0; StateFlags = flags; DeviceName = new string((char)32, 32); DeviceString = new string((char)32, 128); DeviceID = new string((char)32, 128); DeviceKey = new string((char)32, 128); cb = Marshal.SizeOf(this); }
internal static uint ResolveDevNum(string devName, DisplayDeviceStateFlags flag, out bool sucess) { // Asume that the num is less than 10 at the first place uint devNum = 0; sucess = false; Regex pattern = new Regex("(.+?)DISPLAY(\\d+)"); if (flag != 0) { sucess = pattern.IsMatch(devName); // devNum = (uint)devName[11] - '0'; devNum = UInt32.Parse(pattern.Match(devName).Groups[2].Value); } return(devNum); }
public static extern bool EnumDisplayDevices(string lpDevice, uint iDevNum, ref DisplayDevice lpDisplayDevice, DisplayDeviceStateFlags dwFlags);