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;
}运行结果如下: