调用windows api 获取系统分辨率

 

c++中:

int cxScreen,cyScreen;
cxScreen=GetSystemMetrics(SM_CXSCREEN);
cyScreen=GetSystemMetrics(SM_CYSCREEN);

 

c#中:

[DllImport("user32")]
public static extern int GetSystemMetrics(int nIndex); 

//获取分辨率宽度
int x = GetSystemMetrics(0);
//获取分辨路高度
int y = GetSystemMetrics(1);

posted on 2014-04-07 21:49  明月几时有25  阅读(1308)  评论(0编辑  收藏  举报