1

Today I fired up a copy of Microsoft Works 4.5 on Windows 98, and realised that I still don't know how they styled the window title bar to have Microsoft in italics, and a gradient colour. The gradient is not from the theme, as it displays like this on Windows 95 as well (which does not support the native gradient styling like Windows 98).

Below are two screenshots showing this in action in two different themes:

Window Title Bar Gradient in Microsoft Works

Does anyone know how Microsoft achieved this, or if there is any old sample code on how to achieve this on older versions of Windows?

Peter
  • 2,654
  • 2
  • 33
  • 44
  • 2
    [`WM_NCPAINT`](https://learn.microsoft.com/en-us/windows/win32/gdi/wm-ncpaint) – Igor Tandetnik Jun 29 '20 at 01:39
  • And `GetWindowDC()` – jkb Jun 29 '20 at 03:15
  • [DrawCaption](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawcaption) with `DC_GRADIENT` or [GradientFill](https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-gradientfill). – IInspectable Jun 29 '20 at 06:35
  • https://www.codeproject.com/Articles/277/Custom-Captions-Including-Multi-line-Captions – Peter Jul 04 '20 at 04:00
  • @IInspectable That isn't going to work, as those functions were only available on Windows 98 and later. Microsoft added them *because* they added gradient effects to title bars at the system level. This Windows 95 application was doing all custom drawing, but achieving essentially the same thing. – Cody Gray - on strike Jul 24 '20 at 05:21
  • @cod The Windows SDK headers make `GradientFill` and `DrawCaption` conditionally available for `WINVER >= 0x0400`. To my knowledge, `0x0400` includes Windows 95, with Windows 98 being `0x0410`. Though the `DC_GRADIENT` flag is only available starting with Windows 2000. – IInspectable Jul 24 '20 at 08:33
  • @IInspectable Yeah, `DrawCaption` is for sure available on all versions. I would have sworn that `GradientFill` was only available on 98 and later. Oh, now I remember: on 95, you need the `msimg32.dll` library, which exported `GradientFill`. `DC_GRADIENT` should be available with 98 and later, too, not just 2000. That's probably an artifact of MSDN's "updating". – Cody Gray - on strike Jul 24 '20 at 08:36
  • @cod I was looking inside the SDK headers. `DC_GRADIENT` is version-gated with an `#if WINVER >= 0x0500` bracket. I'm not aware of any changes to the actual SDK headers. But maybe there was some quirk to enable its use in Windows 98. – IInspectable Jul 24 '20 at 08:42

0 Answers0