首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 系统运维 >

VC++获取荧幕大小第一篇 像素大小GetSystemMetrics

2013-03-06 
VC++获取屏幕大小第一篇 像素大小GetSystemMetrics《VC++获取屏幕大小第一篇 像素大小 GetSystemMetrics》和

VC++获取屏幕大小第一篇 像素大小GetSystemMetrics

    《VC++获取屏幕大小第一篇 像素大小 GetSystemMetrics》和《VC++获取屏幕大小第二篇物理大小GetDeviceCaps 上》和《VC++获取屏幕大小第三篇物理大小GetDeviceCaps下》这三篇文章主要讲解在VC++下获取屏幕大小。这个功能非常简单,也比较实用。

 

    要获取屏幕的像素大小要使用GetSystemMetrics函数。下面就来看看这个函数的用法:

函数功能:用于得到被定义的系统数据或者系统配置信息

函数原型:

// 获取屏幕大小 像素大小// By MoreWindows( http://blog.csdn.net/MoreWindows )#include <stdio.h>#include <windows.h>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;}

运行结果如下:

 VC++获取荧幕大小第一篇 像素大小GetSystemMetrics

后面二篇《VC++获取屏幕大小第二篇物理大小GetDeviceCaps上》和《VC++获取屏幕大小第三篇物理大小GetDeviceCaps下》将介绍使用GetDeviceCaps函数来获取屏幕的物理大小,欢迎继续浏览。

地址1:http://blog.csdn.net/morewindows/article/details/8502592

地址2:http://blog.csdn.net/morewindows/article/details/8610891

 

转载请标明出处,原文地址:http://blog.csdn.net/morewindows/article/details/8502583

欢迎关注微博:http://weibo.com/MoreWindows


 

热点排行