屏幕分辨率检测&控制 [英] screen resolution detection & control

查看:168
本文介绍了屏幕分辨率检测&控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我怎样才能检测运行我已安装程序的不同计算机的屏幕分辨率并控制它而不调整我的屏幕布局,而目标计算机与我的计算机具有不同的分辨率。



祝你好运,

Forouz

Hello
How could i detect screen resolution of different computer which run my installed program and control it with no resizing of my screen layout while target computer has diiffrent resolution with my computer.

Best regards,
Forouz

推荐答案

将有一个正确的方法执行此操作与控制面板本身用于执行此任务的相同(可能是COM)API进行交互。

但是,如果您确实使用VC6,那么谁知道您是否有标头声明该API我应该能够记住并且不能这样做。

回到我使用VC6的日子里,我们使用了一个简单的技巧来确定屏幕分辨率问题的一部分。我们将使用 GetDesktopWindow 函数来获取桌面的句柄。然后使用句柄调用 GetClientRect 以获取表示桌面的矩形。如果您有一台显示器,桌面覆盖了所有这些,那就是您的工作完成2次调用,您的屏幕矩形在标准化坐标中就是您的屏幕分辨率。

当然在过去的日子里,桌面上的东西更简单,多台显示器延伸的台式机在我们必须支持的东西列表上走了很长一段路。
There is going to be a proper way to do this which interacts with the same ( probably COM ) API that the Control Panel itself uses to do the job.
However if you really are using VC6 then who knows whether you even have the headers declaring that API which I should be able to remember and cannot.
Back in the days when I used VC6 we used a simple trick for the ''determining the screen resolution'' part of the problem. We''d use the GetDesktopWindow function to get the handle to the desktop. Then call GetClientRect with the handle to get the rectangle representing the desktop. If you have a single monitor and the desktop covers all of it that''s your job done with 2 calls you''ve got your screen rectangle which in normalised coordinates is your screen resolution.
Of course back in those old days things were simpler on the desktop and multiple monitor stretched desktops were a long way down the ''things we must support'' list.


这篇关于屏幕分辨率检测&控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆