C++如何获取桌面分辨率大小

C++如何获取桌面分辨率大小,第1张

你在dos命令窗直接打命令:

wmic

desktopmonitor

get

screenwidth,

screenheight

就有分辨率了,例如,显示:

screenheight

screenwidth

768

1024

写c/c++程序,可以用:

system("wmic

desktopmonitor

get

screenwidth,

screenheight");

大小和窗口一致

--

这是平时说的full-screen

(满频)。程序里需要计算和安排的。

在命令行中输入“adb shell” ;进入shell之后,再输入“cat /system/buildprop  grep "product"”  设备信息主要是存放在“/system/buildprop”文件,通过“cat”命令就可以查看了。

adb的全称为Android Debug Bridge,就是起到调试桥的作用。通过adb我们可以在Eclipse中方便通过DDMS来调试Android程序,说白了就是debug工具。

它的主要功能有:

运行设备的shell(命令行)

管理模拟器或设备的端口映射

计算机和设备之间上传/下载文件

将本地apk软件安装至模拟器或android设备

参考资料:

adb驱动—百度百科

解决方案:关闭笔记本与电视,用HDMI线连接笔记本与液晶电视重启笔记本,开启液晶电视,把液晶电视的信息源调整到HDMI模式在笔记本桌面右键,打开ATI3C控制面板,显示卡--桌面和显示器,进入桌面与显示器设置点“检测显示器”,就会看到两个显示器,一个是笔记本,一个是液晶电视选择扩展返回桌面,右键,进入桌面分辨率设置面板,在显示器中选择液晶电视,并勾选“使它成为我的主显示器”

百度一大堆回答啊

1,在Windows下可以使用 GetSystemMetrics(SM_CXSCREEN);GetSystemMetrics(SM_CYSCREEN) 获取。 2,在Linux下可以使用XDisplayWidth ;XDisplayHeight ()获取。

3,在QT中呢?很多人说是 QApplication::desktop()->width();QApplication::desktop()->height(); 这个方法对于单显示器模式当然没有问题。但是对于多显示器,特别是使用了扩展桌面的就会有问题了。今天上午仔细看了QDesktopWidget的帮助,需要使用QApplication::desktop()->screenGeometry();这个函数有好几个重载的版本,意思都一样。该函数返回一个QRect,这个QRect的宽和高就是所在Screen的分辨率。获取方法如下:

void GetScreenInfo()

{

QDesktopWidget desktopWidget = QApplication::desktop();

//获取可用桌面大小

QRect deskRect = desktopWidget->availableGeometry();

//获取设备屏幕大小

QRect screenRect = desktopWidget->screenGeometry();

g_nActScreenX = screenRectwidth();

g_nActScreenY = screenRectheight();

//g_nActScreenX = deskRectwidth();

//g_nActScreenY = deskRectheight();

//获取系统设置的屏幕个数(屏幕拷贝方式该值为1)

g_nScreenCount = desktopWidget->screenCount();

}说到这里,顺便标记以下多屏幕设置成拷贝方式时,获取的屏幕的个数是一个,只有设置成扩展时才返回多个。

打印屏幕分辨率和个数信息:

void printscreeninfo()

{

QDesktopWidget dwsktopwidget = QApplication::desktop();

QRect deskrect = dwsktopwidget->availableGeometry();

QRect screenrect = dwsktopwidget->screenGeometry();

QDesktopWidget dwsktopwidget = QApplication::desktop();

QRect deskrect = dwsktopwidget->availableGeometry();

QRect screenrect = dwsktopwidget->screenGeometry();

int scrcount = dwsktopwidget->screenCount();

qCritical("screenrectw==%s\n",qPrintable(QString::number(screenrectwidth())));

qCritical("screenrecth==%s\n",qPrintable(QString::number(screenrectheight())));

qCritical("deskrectw==%s\n",qPrintable(QString::number(deskrectwidth())));

qCritical("deskrecth==%s\n",qPrintable(QString::number(deskrectheight())));

qCritical("scrcount==%s\n",qPrintable(QString::number(scrcount)));

}

以上就是关于C++如何获取桌面分辨率大小全部的内容,包括:C++如何获取桌面分辨率大小、如何用adb命令 获得Android手机分辨率、怎么获取双屏电脑上面副屏的分辨率等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/10623360.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-10
下一篇 2023-05-10

发表评论

登录后才能评论

评论列表(0条)

保存