win32编程中根据系统屏幕大小定位窗口

发布于 2024-08-11 04:58:21 字数 76 浏览 2 评论 0原文

我使用 CreateWindow 创建了一个窗口。但是有没有任何API可以给出系统屏幕的高度和宽度。这样根据系统屏幕定位窗口将非常有帮助。

I have creating one window using CreateWindow. But is there any api which can give system screen height and width of the system. So that it will very helpful to locate windows according to the system screen.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

失而复得 2024-08-18 04:58:21

GetDesktopWindow() 函数将为您提供桌面窗口的句柄。
然后,您可以使用 GetWindowRect()< 查询其大小/a>

编辑: 请注意,这将为您提供主显示器的大小。要处理多个监视器,您需要使用 GetMonitorInfo()< /a>

The GetDesktopWindow() function will give you a handle to the desktop window.
You can then query this for it's size using GetWindowRect()

Edit: Note that this will give you the size of the primary display. To handle multiple monitors you will need to use GetMonitorInfo()

缱倦旧时光 2024-08-18 04:58:21

要获取主显示器上工作区的大小,请调用 SystemParametersInfoSPI_GETWORKAREA

或者,您可以传递 CW_USEDEFAULT (-1)作为 x 坐标,Windows 将为您选择窗口的位置。

To get the size of the workarea on the primary monitor, the call to make is SystemParametersInfo with SPI_GETWORKAREA.

Alternativly you can pass CW_USEDEFAULT (-1) as the x-co-ordinate and windows will pick a position for the window for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文