Minimize/restore windows programmatically skipping the animation effect

GetFree picture GetFree · May 21, 2011 · Viewed 8.8k times · Source

I need to perform several operations on a list of windows (minimize some of them, restore others) in order to switch between two or more set of windows at once.

The problem with this are those animations you can see when minimizing and restoring a window. The whole process look terrible with all those animations going in and out, up and down.
I cannot, however, disable those animations because this is for other computers and i dont want to change other people's settings, plus those animations are actually useful when you minimize/restore one window only (i.e. when YOU do it manually) because you can see what is happening, but for doing it programmatically on several windows at a time, it's not nice.

I'm currenlty using the SendMessage function to send the WM_SYSCOMMAND message with params SC_MINIMIZE/SC_RESTORE. I dont know whether there is another way.

So, the question:
How can I minimize/restore a window programatically without the animation effect??

PS: The programming language is not important. I can use any language that's nessesary for accomplishing this.

Answer

Sertac Akyuz picture Sertac Akyuz · May 22, 2011

SetWindowPlacement with SW_SHOWMINIMIZED or SW_RESTORE as appropriate for showCmd in WINDOWPLACEMENT seems to bypass window animation. I'd keep an eye on the functionality for future versions of the OS though since documentation does not mention anything about animation.