从使用glfw创建的窗口中删除最大化按钮 [英] Removing the maximize button from a window created using glfw

查看:290
本文介绍了从使用glfw创建的窗口中删除最大化按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从使用glfwopenWindow函数调用创建的窗口中删除最大化按钮?

How do you remove the maximize button from a window created usingg the glfwopenWindow functionn call ?

当前,我正在做的是:

windowHandle = GetForegroundWindow();
long Style = GetWindowLong(windowHandle, GWL_STYLE);
Style ^= WS_MAXIMIZEBOX;
SetWindowLong(windowHandle, GWL_STYLE, WS_MAXIMIZEBOX);

在这里,我得到了窗口句柄,然后切换了最大化位.然后,我重新应用窗口样式.但这是行不通的,它会使窗口完全空白,而没有任何按钮或标题栏.无论如何,有没有要删除最大化按钮.每当调用resize函数时,我都不想更改窗口大小.

Where, I get the window handle and then toggle the maximize bit. Then I re-apply the window style. But this doesn't work an it makes the window completely blank without any buttons or title bar. is there anyway to remove the maximize button. I dont want to change the window size whenever the resize function is called

推荐答案

您的代码存在错误,因为您没有传递回旧样式,因此清除了除WS_MAXIMIZEBOX之外的所有样式标志,它应显示为:

you code is bugged, as you don't pass back the old style, thus clearing all the style flags except WS_MAXIMIZEBOX, it should read:

windowHandle = GetForegroundWindow();
long Style = GetWindowLong(windowHandle, GWL_STYLE);
Style &= ~WS_MAXIMIZEBOX; //this makes it still work when WS_MAXIMIZEBOX is actually already toggled off
SetWindowLong(windowHandle, GWL_STYLE, Style);

此外,如果您计划将来实现任何x64兼容性,则应该真正使用基于GetWindowlongPtr的功能

also, you should really use the GetWindowlongPtr based functions if you plan on any future x64 compatability

这篇关于从使用glfw创建的窗口中删除最大化按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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