Click here to Skip to main content
Click here to Skip to main content

Minimize any window to system tray using Windows Hook

By , 29 Oct 2003
 

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:

  1. How to make a particular window be minimized to the system tray?
  2. 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

  1. 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.
  2. If you find any improvement or suggestion, please let me know.

Thank you for reading my article!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Chau Nguyen
Web Developer
United States United States
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalanybody know how to track clicks to the upper left iconmemberRogerPack30-Mar-09 9:52 
GeneralRe: anybody know how to track clicks to the upper left iconmemberRogerPack7-Apr-09 10:36 
GeneralRe: anybody know how to track clicks to the upper left iconmemberRogerPack23-Apr-09 8:20 
QuestionCan I handle events other than "Tray Me"?member'¯`°²¤ zee ¤²°`¯'6-Sep-07 12:51 
Generaljust what I wanted.memberguoxu31-Aug-07 15:54 
GeneralThxmemberxgo20-Mar-07 2:28 
GeneralWindow movement restrictionmemberAKG20-Feb-07 21:59 
GeneralThanksmembermike34711-Feb-07 21:53 
GeneralSimple and NeatmemberSRV_Bala27-Sep-06 1:38 
GeneralAdds multiple "Tray Me" entries [modified]membergondola7-Aug-06 12:02 
GeneralThankyoumemberrimblock18-Jul-06 14:02 
GeneralThank you!memberchick8031-May-06 22:57 
GeneralC# ExamplememberXWreckage24-May-06 6:39 
General"Free minimized windows" suggestionmemberanat0lik15-May-06 4:55 
GeneralRe: "Free minimized windows" suggestionmemberRogerPack7-Apr-09 10:39 
GeneralRequires two clicks with many apps like IE, etcsussrxxs1-Aug-05 14:22 
QuestionNot working with XP Media Center Edition?membertiecoon4-Jun-05 8:44 
GeneralNovell GroupWisemembermeink15-Mar-05 11:20 
QuestionWhy doesn't it work with CMD windows?memberRabbej12-Feb-05 3:41 
AnswerRe: Why doesn't it work with CMD windows?membernosek13-Dec-05 3:58 
GeneralRe: Why doesn't it work with CMD windows?memberkalantir12-Nov-07 20:53 
GeneralCan't compile codememberShomBando29-Dec-04 12:38 
GeneralNot working properly in Win98memberSomersault606-Dec-04 4:23 
QuestionHow do I use this AppmemberFranklin577527-Jan-04 4:38 
AnswerRe: How do I use this AppmemberAsh Lux18-Apr-04 16:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130619.1 | Last Updated 30 Oct 2003
Article Copyright 2003 by Chau Nguyen
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid