On Windows 7 with the Aero theme, Notepad++'s Preferences window has square corners, no system menu icon, a close button, and a darker 1px border. This window also has an AlwaysOnTop attribute.

(I resized the window to fit a width of 640px.)

Interestingly enough, you can copy this style to other windows using AutoHotkey. So, it would seem that there is no dirty tricks involved. However, I don't think I've seen this window style anywhere else.

Is using this style condemned by Microsoft? Does this type of window have a name?

2 Answers
2

It's called a Tool(bar) Window. Any windows that have the WS_EX_TOOLWINDOW extended style will be rendered without a system menu or minimize/maximize boxes, and a small titlebar. In Windows XP and up (that support themes), tool windows are usually rendered without rounded corners (at least with the default themes).

This style is usually used for toolbars (Figure 1). You can see it by dragging a toolbar off of a program that lets you rearrange the toolbars. Notice that it becomes a window that looks like the one in question. Windows Explorer also uses it for deskbands (Figure 2) which are basically the same thing. You can see these by dragging a folder to one of the screen edges, then drag the resulting toolbar/deskband out to the desktop.

Obviously some programs use the style for other purposes, often as a way of creating a sort of modal, temporary dialog that is a child to the main program.

Note: this has a couple of effects (the first two of which are usually the reasons for its non-standard usage):

A window/dialog with this style does not get a button on the taskbar

It prevents Alt+Tabbing to the dialog

It also prevents the Alt+PrtScr from capturing just the dialog; the whole parent program window is captured.

This details the name of this window style and the options available in .NET; see @Synetech's excellent answer for the original purpose of this window style, the reasons it may be used for such a dialog box and the implementation in unmanaged Windows programs such as Notepad++.

The window has square corners and looks like that because one of the designers/programmers of Notepad++ decided to use a specific window style. Synetech details the advantages of that window style.

The ToolWindows in .NET with all values default work a little differently from a plain WS_EX_TOOLWINDOW in the Windows API, though they look the same. With testing, I have determined that they do appear on the taskbar and they do appear on the Alt+Tab task switcher unless the form property ShowInTaskbar is set to false. ShowInTaskbar affects visibility in both the taskbar and Alt+Tab for ToolWindows, but only taskbar for others.

Meanwhile, it is also possible to remove the icon/minimise/restore/maximise buttons from the more common window styles, though it does not seem to be possible to add them to ToolWindows. It is also possible to hide normal windows from the taskbar.

The only functional advantage WS_EX_TOOLWINDOW offers, as far as I can tell, is that the window does not appear in Alt+Tab.

I have included some screenshots comparing the .NET window styles. These are not directly used by Notepad++, nor other unmanaged programs, but are named by Microsoft, so...

Possible values of FormBorderStyle:

The first image is a screenshot of the running program with Aero enabled, the second is from the Visual Studio designer view (no Aero).Click the images for the full size versionsDescriptions are taken from the MSDN article on the FormBorderStyle enumeration.

None

No border.

FixedSingle

A fixed, single-line border.

Fixed3D

A fixed, three-dimensional border.

FixedDialog

A thick, fixed dialog-style border.

Sizable (default)

A resizable border.

FixedToolWindow

A tool window border that is not resizable. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB. Although forms that specify FixedToolWindow typically are not shown in the taskbar, you must also ensure that the ShowInTaskbar property is set to false, since its default value is true.

SizableToolWindow

A resizable tool window border. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB.

It has nothing to do with managed/unmanaged or native/.NET code. It is simply a matter of how Windows styles windows with the WS_EX_TOOLWINDOW style. .NET simply aliases FixedToolWindow to WS_EX_TOOLWINDOW and SizableToolWindow to WS_EX_TOOLWINDOW|WS_THICKFRAME. No offence, but this answer doesn’t actually answer the question or explain the behavior asked, it is simply a list/resource of different window styles used in .NET.
–
SynetechJun 14 '12 at 7:33

@Synetech I am aware it has nothing to do with whether the code is managed or not, I just thought I would give the name .NET uses and the other options available, with screenshots of the differences. Does this type of window have a name? It does answer that much, at least from a .NET programmer's perspective. And explanation? Because the programmer felt like using it. You've listed possibly desired effects. That's about it. Whether it's recommended or condemned by MS, I have no idea. Personally, I think you've done an admirable job at explaining it.
–
BobJun 14 '12 at 7:50