[DllImport("gdi32.dll")] public extern static int GetDeviceCaps( IntPtr hdc, // handle to the device context int nIndex // index of capability to query );[DllImport("gdi32.dll")] public static extern IntPtr CreateDC( string lpszDriver, // driver name string lpszDevice, // device name string lpszOutput, // not used; should be NULL Int64 lpInitData // optional printer data );[DllImport("gdi32.dll")] public static extern int DeleteDC( IntPtr hdc // handle to DC ); private void button1_Click(object sender, System.EventArgs e) { IntPtr hwnd=new IntPtr(); hwnd=CreateDC("DISPLAY",null,null,0); this.richTextBox1.Text=GetDeviceCaps(hwnd,116).ToString(); DeleteDC(hwnd); }
ManagementObjectCollection objs = _auditor.Connector.CreateCollection("Win32_VideoController"); foreach (ManagementObject obj in objs) { Video vid = new Video(); _videoes.Add(vid); vid.Frequency = (UInt32)obj["CurrentRefreshRate"]; }
public extern static int GetDeviceCaps(
IntPtr hdc, // handle to the device context
int nIndex // index of capability to query
);[DllImport("gdi32.dll")]
public static extern IntPtr CreateDC(
string lpszDriver, // driver name
string lpszDevice, // device name
string lpszOutput, // not used; should be NULL
Int64 lpInitData // optional printer data
);[DllImport("gdi32.dll")]
public static extern int DeleteDC(
IntPtr hdc // handle to DC
);
private void button1_Click(object sender, System.EventArgs e)
{
IntPtr hwnd=new IntPtr();
hwnd=CreateDC("DISPLAY",null,null,0);
this.richTextBox1.Text=GetDeviceCaps(hwnd,116).ToString();
DeleteDC(hwnd);
}
foreach (ManagementObject obj in objs)
{
Video vid = new Video();
_videoes.Add(vid);
vid.Frequency = (UInt32)obj["CurrentRefreshRate"];
}