
Introduction
This is a simple system tray utility which allows you to quickly Shutdown,
Restart, Log Off, Hibernate or Standby just with a mouse click. As you can see
from the screen shot, it will allow you to choose any action from the Context
menu or execute the default menu action by just double clicking the menu item.
This is very handy compared to the usual way of Start->ShutDown and then
choose the action.
Features
- Fast and compact. The executable is only 35 KB. It is
packed with UPX. Original file size is only 72 KB.
- Easy to customize. The user can select the menu items
which should appear in the Context menu and the Default menu item. The action associated
with this default menu item will be processed upon double clicking
the System Tray Icon.
- The user can also decide whether to force the system
to undergo the actions displayed in the context menu. In this case the system
will not wait for any programs to close and you will lose the unsaved data.
But this useful when you get stuck with some program.
- It will work on any platform, from Windows 95 to Windows XP Pro and Home
Edition.
Code Details
This version of the Application was written using WTL 7.0
library. It uses no WTL 7.0 specific features, and it can be compiled with WTL
3.1 or 3.0. Earlier versions of this Application was written using API. But I
think that an Object Orient Approach would be far better in this kind of
situations.
For system Shutdown, Restart and Log Off ExitWindowsEx
API is used. For Hibernation and Standby
modes SetSystemPowerState
API is used.
The program stores its settings in file instant.ini
instead of using System Registry.

I have used a Tree Control which allows the user to
select the default menu action and Items to be displayed in the context menu. I
have derived a new class to achieve Internet Explorer like Options Dialog. You
must choose at least one menu item to be displayed in the context menu and one
default menu item. You van also specify whether to force the system to undergo
the clicked action. In the Settings category it is shown whether
to force the system shutdown, but it will work for all the five menu
items.
Last words ...
I have written all the components required for this application specifically for this Application. If you need to use any of the
components you have to
Add/Remove some code to/from the existing code. The code is not commented. But
functions names will tell you what I did. I think it can be easily understood.
The settings saving could be done in registry. I have used MFC's VERIFY
to catch bugs very
easily. And it worked for me very well and I could catch some bugs with
that Tree Control. Expect Bugs...