设为首页 加入收藏

TOP

VC++获取屏幕大小第一篇 像素大小GetSystemMetrics (二)
2014-11-23 19:15:36 来源: 作者: 【 】 浏览:64
Tags:获取 屏幕 大小 第一篇 像素 GetSystemMetrics
70
#if(WINVER >= 0x0400)
#define SM_CXMENUCHECK 71 /* Use instead of GetMenuCheckMarkDimensions()! */
#define SM_CYMENUCHECK 72
#define SM_SLOWMACHINE 73
#define SM_MIDEASTENABLED 74
#endif /* WINVER >= 0x0400 */
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
#define SM_MOUSEWHEELPRESENT 75
#endif
#if(WINVER >= 0x0500)
#define SM_XVIRTUALSCREEN 76
#define SM_YVIRTUALSCREEN 77
#define SM_CXVIRTUALSCREEN 78
#define SM_CYVIRTUALSCREEN 79
#define SM_CMONITORS 80
#define SM_SAMEDISPLAYFORMAT 81
#endif /* WINVER >= 0x0500 */
#if (WINVER < 0x0500) && (!defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400))
#define SM_CMETRICS 76
#else
#define SM_CMETRICS 83
#endif
//http://blog.csdn.net/more windows/article/details/8502583
呵呵,够多吧,不用记,要用的时候查下MSDN就好了。由MSDN可以知道传入SM_CXSCREEN和SM_CYSCREEN就得到屏幕的宽和高。详见代码:
[cpp]
// 获取屏幕大小 像素大小
// By MoreWindows( http://blog.csdn.net/MoreWindows )
#include
#include
int main()
{
printf(" 获取屏幕大小 像素大小\n");
printf(" -- By MoreWindows( http://blog.csdn.net/MoreWindows ) --\n\n");
int nScreenWidth, nScreenHeight;
nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
printf("屏幕大小(像素) 宽:%d 高:%d\n", nScreenWidth, nScreenHeight);
return 0;
}
// 获取屏幕大小 像素大小
// By MoreWindows( http://blog.csdn.net/MoreWindows )
#include
#include
int main()
{
printf(" 获取屏幕大小 像素大小\n");
printf(" -- By MoreWindows( http://blog.csdn.net/MoreWindows ) --\n\n");
int nScreenWidth, nScreenHeight;
nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
printf("屏幕大小(像素) 宽:%d 高:%d\n", nScreenWidth, nScreenHeight);
return 0;
}运行结果如下:
\
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇VC++ 修改计算机名称 SetComputer.. 下一篇VC++ 得到计算机名和用户名 GetCo..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: