会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
静观其变
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
取得屏幕刷新率
using
System;
using
System.Runtime.InteropServices;
namespace
ConsoleApplication
{
public
sealed
class
EntryPoint
{
private
EntryPoint()
{}
[DllImport(
"
Gdi32.dll
"
, CharSet
=
CharSet.Auto, ExactSpelling
=
true
)]
public
static
extern
int
GetDeviceCaps(IntPtr hDC,
int
nIndex);
/**/
///
<summary>
///
获得屏幕刷新率
///
</summary>
public
static
int
RefreshRate
{
get
{
IntPtr desktopDC
=
GetDC(GetDesktopWindow());
return
GetDeviceCaps(desktopDC,
116
);
}
}
[DllImport(
"
User32.dll
"
)]
public
extern
static
IntPtr GetDesktopWindow();
[DllImport(
"
User32.dll
"
)]
public
static
extern
IntPtr GetDC(IntPtr hWnd);
static
void
Main()
{
Console.WriteLine(
"
屏幕刷新率为: {0}Hz
"
,RefreshRate);
Console.ReadLine();
}
}
}
posted on
2005-08-08 09:48
wangyue
阅读(
1321
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部