Background
This isn't particularly a priority issue, but it's a small bug with some default Windows programs that can be corrected.
In UIRibbon applications, there is a visual error that can be seen on NTStyle (from the README.md document):
Explanation
This bug occurs due to UIRibbon expecting extended frames under DWM. Because NTStyle forcefully disables DWM on the application, extended frames don't work correctly and the extra allocated space is clearly seen in the client area for the window. This bug also occurs on Windows 8+ versions of UIRibbon, regardless of whether or not DWM is running. It is also observed with official implements of client-side decorations, such as Win32k (classic theme) and UxTheme (XP/Aero Basic theme engine).
To recap, here are the following cases this may occur:
- Under Windows Vista or 7 (or its respective UIRibbon version) when DWM composition is enabled system-wide, the application is not lied to about the DWM composition state via dwmapi hooking, and the window is forced to not use DWM system frames via
DwmSetWindowAttribute
.
- Under Windows 8+ when the window is forced to not use DWM system frames via
DwmSetWindowAttribute
.
Proposal
Since you can detect the presence of UIRibbon in an application easily (via current application image name, loaded module image names, child window class name searching, or even a combination of all three), and because the extraneous space is highly predictable (it's the same size as DWM titlebars), a hack can be used for UIRibbon applications to crop this space from the window via custom handlers for window messages like WM_NCCALCSIZE
, WM_NCHITTEST
, and WM_NCPAINT
.
The following information may useful for implementing a system to detect the presence of UIRibbon in a program or window:
EnumProcessModules
from psapi.h
can be used to search for UIRibbon.dll
in all supported operating systems (Windows NT 4.0+, not supported in 9x).
- UIRibbon creates several windows with the class name
UIRibbonCommandBarDock
for its UI.
- The following default Windows programs use UIRibbon by default since Windows 7:
- Paint
%SystemRoot%\System32\mspaint.exe
(+ x86 copy in SysWOW64)
- Windows Wordpad Application
%ProgramFiles%\Windows NT\Accessories\wordpad.exe
(+ x86 copy)
- Windows Explorer
%SystemRoot%\explorer.exe
(since Windows 8, only for some windows)
This may not seem a desirable solution (it is really hacky, after all), but it's the easiest solution that I can think of for this case. Another solution is to hook UIRibbon, but this is:
- The hardest thing in the world. I have not figured out how to do this myself.
- Requires downloading debugging symbols from Microsoft, which may not be available in some areas of the world.