Introduction
There're times when your desktop becomes "dirty" because there're many applications running. Among them, there're some you have to let run during your work (E.g.: I have to let the MS Outlook run all the time). If you minimize them, they will make your task bar crowded. I chose to minimize them to the system tray for my own convenience. So, I decided to write a tiny utility to make all windows minimized to the system tray.
How To?
To solve my problem, I have to answer the following questions:
- How to make a particular window be minimized to the system tray?
- How to make any window to accept my command (minimized it to system tray)?
The first question is not very difficult. There're many articles about this topic. The second question is not very difficult either. I just use Windows Hooks to intercept some Windows messages when a window menu (system menu) of a window is being displayed, then I append a menu item of my own into this window menu. When a user choose this menu item, Windows will send a message to that hooked application, I intercept this message again, and minimize the application to the system tray. When a user clicks on an icon in the system tray of a hooked application, Windows will send a message to that application, I intercept this message again, and restore that application window, and remove its icon from the system tray. That's all. I have commented so much in my source code, so you can read and understand it easily.
Open Issues
- When you exit or disable this utility while there is any application minimized to the system tray, those application will not be restored properly, you must restore all hooked applications before you exit or disable this utility. I'll fix this defect in future, but if someone has any idea about this issue, please share it with me.
- If you find any improvement or suggestion, please let me know.
Thank you for reading my article!
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.