Holy cow, I wrote a book!
A customer wanted to know how they can disable the default fade-in/fade-out animation that occurs when a window is hidden or shown. "I don't want to use WS_EX_TOOLWINDOW because that causes my window to disappear from the taskbar. I tried DwmEnableComposition but that affects the entire desktop and is too jarring. We want to suppress the effect because our program replaces one window with another, and we want the operation to be invisible to the user."
WS_EX_TOOLWINDOW
DwmEnableComposition
Whoa, heading straight for DwmEnableComposition? That's using a global solution to a local problem.
To disable the animations on a specific window, use something like this:
HRESULT DisableDwmAnimations(HWND hwnd) { BOOL fDisable = TRUE; return DwmSetWindowAttribute(hwnd, DWMWA_TRANSITIONS_FORCEDISABLED, &fDisable, sizeof(fDisable)); }
Re-enabling the animations is left as an exercise for the reader.