如何获得winapi窗口的宽度和高度? [英] How to get the width and height of a winapi window?

查看:264
本文介绍了如何获得winapi窗口的宽度和高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

As the title says, I need to know the dimensions of a window and I do not know what api I have to use ...

I have looked unsuccessfully at GetWindowInfo, GetWindowPlacement and SetRect.

Could you please help me?





我尝试了什么:





What I have tried:

As the title says, I need to know the dimensions of a window and I do not know what api I have to use ...

I have looked unsuccessfully at GetWindowInfo, GetWindowPlacement and SetRect.

Could you please help me?

推荐答案





这里没有提供很多细节,但我知道你正在使用Windows API处理Windows表单。如果是这样,我会使用GetWindowRect - 请参阅 GetWindowRect函数( Windows) [ ^ ]。这将为您提供边界矩形,您可以从该矩形获得宽度,高度。



玩得开心

G
Hi,

You aren't providing many details here, but I gather you are working with Windows forms using the Windows API. If so, I'd use GetWindowRect - see GetWindowRect function (Windows)[^] . This will give you the bounding rectangle and you can get the width, height from that rectangle.

Have fun
G


这篇关于如何获得winapi窗口的宽度和高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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