September 11th, 2026
0 reactions

How can I remove the Close button from my window caption?

Occasionally, somebody wants to create a window without a Close button.

The only way to get rid of the Close button is not to have a System menu at all: Remove the WS_SYS­MENU style from the window. But that also gets rid of the Minimize and Maximize buttons, so it’s kind of drastic.

If you want a System menu, or if you want Minimize and Maximize buttons, you can at least disable the Close button by disabling the SC_CLOSE menu item.

HMENU menu = GetSystemMenu(hwnd, FALSE);
EnableMenuItem(menu, SC_CLOSE, MF_DISABLED);

Of course, you could use the nuclear option and implement your own custom title bar. Then you can do whatever you want. But most people are probably not willing to take things to such an extreme.

But really, try not to hide or disable the Close the button at all. End users don’t like it. It makes them feel trapped.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

1 comment

Sort by :
  • Dan Bugglin 3 hours ago

    Ahh my work IT has some third-party apps that do this. As a responsible employee I try not to go to Task Manager and kill them (I have found a good way to work is if IT is not mad at you). But they also seem to forget you can just fling them to the bottom right corner of the screen so only a smidge is visible until they decide to go away on their own.