Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / MFC
Article

Shutdown - an alternative to Windows Shutdown dialog

Rate me:
Please Sign up or sign in to vote.
2.18/5 (7 votes)
25 Oct 20063 min read 116.2K   2.1K   31   17
It is an alternative to windows XP shutdown dialog
Shutdown Dialog.

Shutdown dialog with extra options.

T.O.C.

  1. Description. [#]
  2. Introduction. [#]
  3. Features. [#]
  4. Programming. [#]
  5. Usage/Help. [#]
  6. Disclaimer. [#]
[ ^ ]

Description

It is an alternative to windows XP shutdown dialog. It has more features than the traditional shutdown dialog, like process enumeration, auto-run, and registered services. It also makes use of regions to make custom shapes. It can be used in Windows 95, 98, NT4, 2000, ME for a XP style shutdown dialog.

[ ^ ]

Introduction

The shutdown program is a small program that I coded a few years back while learning C++. I had coded it using Dev C++ using pure C++ and win32 apis. It is a small program which mimics the windows shutdown dialog. It uses GDI to make custom shapes and custom buttons.

[ ^ ]

Features

The main features of shutdown are

  1. It can shutdown any PC running Windows operating system.
  2. It suitably uses the required permission to shutdown a pc running on windows NT, actually I have copied the code from a MSDN example.
  3. Option to power off and manual shutdown.
  4. Custom shape using GDI.
  5. Running process enumeration.
  6. Auto run list.
  7. Registered services list.
  8. Class Probe (non-functional)
  9. Window animations (for winver > win2000)

[ ^ ]

Programming

The programming for the shutdown is quite straight forward. It is programmed using pure C++. Some of the details if any one wants to know about,

The Shape:

It is done by applying regions to the dialog. The program mainly uses 3 regions. First the normal state, Second region for the expanded state, and the third region for catching the mouse click. I have carefully created the regions using various combinations of round rectangles by trial and error method. Once the region is applied the shape of the dialog outside the region becomes transparent. The portion of dialog out side the region also becomes transparent to the mouse events.

For the drop down button, I have tracked the hit–test for the third region.

Shutdown:

For machines running on NT, shutdown API ExitWindowsEx () requires privileges. The required privilege is accessed before the shutdown function call. After the call to the ExitWindowsEx () API it returns immediately thus providing time for the program to exit. But before exiting the program resets the privilege.

Process Enumeration:

It uses EnumProcessModules() and other info please look into the code.

The Class Probe:

Please refer to my working class probe article at http://www.codeproject.com/threads/classprobe.asp

[ ^ ]

Usage / Help

Launch the program. Check the power off if you want to power off the machine. Note it doesn’t have any effect while logging off or restarting the Computer. Click the shutdown to shutdown Windows and if your computer supports automatic power off it will power-off the computer.

[ ^ ]

Disclaimer

This code and the executable don’t claim to be perfect and error free. It also doesn’t come with any warranties and even any implied warranty of being fit for any proposes what so ever which includes "merchantability".

If there was any mistake in the writing, it is regretted.

I am currently looking for some persons to join in my open source project. If any one wants to contribute he/she is most welcome. My project is not personal and every one is invited... I am developing a multiplatform IDE for C/C++ with its own class lib, APIs and classes using pure C/C++.

Please visit: http://thunder.sourceforge.net for details

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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionC:\Programs\Dev-Cpp\projects\Shutdown\HOOKDLL\dll.h not found Pin
Johannes Weidenauer6-Mar-13 2:10
Johannes Weidenauer6-Mar-13 2:10 
QuestionGreat work..bt need help.. Pin
MacGadger28-Feb-07 19:43
MacGadger28-Feb-07 19:43 
AnswerRe: Great work..bt need help.. Pin
sanjit_rath25-Sep-07 8:08
sanjit_rath25-Sep-07 8:08 
Generalgaaaaaaah Pin
DannSmith20-Oct-06 14:59
DannSmith20-Oct-06 14:59 
GeneralRe: gaaaaaaah Pin
sanjit_rath20-Oct-06 15:02
sanjit_rath20-Oct-06 15:02 
Smile | :) Try to compile it with any compiler. are you getting any errors ?




Cheers Blush | :O

GeneralRe: gaaaaaaah Pin
sanjit_rath20-Oct-06 15:06
sanjit_rath20-Oct-06 15:06 
GeneralRe: gaaaaaaah Pin
DannSmith20-Oct-06 15:32
DannSmith20-Oct-06 15:32 
GeneralRe: gaaaaaaah Pin
sanjit_rath20-Oct-06 17:22
sanjit_rath20-Oct-06 17:22 
GeneralRe: gaaaaaaah Pin
sanjit_rath25-Oct-06 10:51
sanjit_rath25-Oct-06 10:51 
Generalcompiling problems Pin
thomas montague26-Jan-05 7:10
thomas montague26-Jan-05 7:10 
GeneralRe: compiling problems Pin
sanjit_rath26-Jan-05 22:05
sanjit_rath26-Jan-05 22:05 
Generalnew Devils ^^oo00oo^^ Pin
sanjit_rath17-Nov-04 14:55
sanjit_rath17-Nov-04 14:55 
Generalhello Pin
yaoyu21-Oct-04 19:50
yaoyu21-Oct-04 19:50 
GeneralRe: hello Pin
sanjit_rath27-Oct-04 7:51
sanjit_rath27-Oct-04 7:51 
GeneralRe: hello Pin
yaoyu31-Oct-04 6:27
yaoyu31-Oct-04 6:27 
GeneralRe: hello Pin
ThatsAlok26-Oct-06 18:33
ThatsAlok26-Oct-06 18:33 
GeneralRe: hello Pin
sanjit_rath26-Oct-06 19:07
sanjit_rath26-Oct-06 19:07 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.