# Making a custom titlebar

**URL:** <https://discourse.glfw.org/t/making-a-custom-titlebar/2392>\
**Category:** support\
**Created:** [June 3, 2023, 6:47pm UTC](https://discourse.glfw.org/t/making-a-custom-titlebar/2392 "2023-06-03T18:47:15Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![BleastT](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/bleastt/32/774_2.png) [@BleastT](https://discourse.glfw.org/u/BleastT)\
**Post date:** [June 4, 2023, 11:59pm UTC](https://discourse.glfw.org/t/making-a-custom-titlebar/2392/6 "2023-06-04T23:59:34Z")

</div>

Hey so on windows i added this code:

```auto
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>

#include <Windows.h>
#include <dwmapi.h>

    void disableTitlebar(GLFWwindow* window)
    {
        HWND hWnd = glfwGetWin32Window(window);

        // Remove the title bar
        LONG_PTR lStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
        lStyle &= ~WS_CAPTION;
        SetWindowLongPtr(hWnd, GWL_STYLE, lStyle);

        // Set the window shape and rounded corners
        DWMNCRENDERINGPOLICY policy = DWMNCRP_ENABLED;
        DwmSetWindowAttribute(hWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof(policy));

        // Extend the frame into the client area
        MARGINS margins = { 0 };
        DwmExtendFrameIntoClientArea(hWnd, &margins);

        // Adjust the window size to remove the thin frame at the top
        RECT windowRect;
        GetWindowRect(hWnd, &windowRect);
        SetWindowPos(hWnd, NULL, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_FRAMECHANGED | SWP_NOMOVE);
    }

```

With this, the titlebar disappear and im able to keep resizing and rounded corners. Snapping the window also works on windows 11-10.

Unfortunately there is a small issue. In the place where there was the title bar, there is a very thin white frame which does not have any purpose. It’s just there and it’s really annoying.  
I cant find a way to remove it ☹

 ![Screenshot 2023-06-04 180335](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/51f92314d93b9cb2d67ea53a81b6c5683937a712.png)

---

_[View the full topic](https://discourse.glfw.org/t/making-a-custom-titlebar/2392)._
