# Is it possible to create a window with just a close button

**URL:** <https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658>\
**Category:** support\
**Created:** [September 16, 2020, 10:54am UTC](https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658 "2020-09-16T10:54:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/masy/32/410_2.png) [@Masy](https://discourse.glfw.org/u/Masy)\
**Post date:** [September 16, 2020, 10:54am UTC](https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658/1 "2020-09-16T10:54:52Z")

</div>

I’m currently writing my own GUI library with OpenGL and I’m trying to implement message boxes.

If I disable resizing it just disables the maximize button, but the minimize (or iconify as glfw calls it) is still interactable. I would prefer it when the buttons weren’t visible at all, like in “true” windows message boxes. Is there a way to disable/hide these buttons?

---

<div class="post-metadata">

**Author:** ![mmozeiko](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mmozeiko/32/29_2.png) [@mmozeiko](https://discourse.glfw.org/u/mmozeiko)\
**Post date:** [September 16, 2020, 12:42pm UTC](https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658/2 "2020-09-16T12:42:38Z")

</div>

You cannot do that with just GLFW. But if you’re OK with using OS specific API you can get access to native window handle by using functions in `glfw3native.h` and modify its style depending on platform.

For example on Windows you can get HWND by calling `glfwGetWin32Window` and then you can remove min/max button by removing `WS_MAXIMIZEBOX` and `WS_MINIMIZEBOX` from window style:

```auto
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtrA(hwnd, GWL_STYLE) & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));

```

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 16, 2020, 12:57pm UTC](https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658/3 "2020-09-16T12:57:13Z")

</div>

@mmozeiko’s solution is likely the best, but you could also use a non decorated window and add the close widget yourself - Dear ImGui uses this for the docking branch external windows and it works well, though they are not natively styled.

---

<div class="post-metadata">

**Author:** ![Masy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/masy/32/410_2.png) [@Masy](https://discourse.glfw.org/u/Masy)\
**Post date:** [September 16, 2020, 1:00pm UTC](https://discourse.glfw.org/t/is-it-possible-to-create-a-window-with-just-a-close-button/1658/4 "2020-09-16T13:00:26Z")

</div>

@mmozeiko Solution works at least on Windows. I’m more of a fan of that solution as I don’t want to do custom titlebars yet. I have to look into how to disable the buttons with x11 though because I primarly use linux at home.
