![]() |
My Project:ShutDown Timer ver 1.0
1 Attachment(s)
The sample project using MFC is intended to either shutdown, logoff, or restart the computer at a given time or immediately. This is a Visual C++ Project using the concept of Win32 APIs with MFC. The Shutdown Timer application also uses System Tray Interface to handle it with menu options.
API for ShutDown: The ExitWindowEx is the API which can be used in Visual C++ for shutting down a workstation. There is one more API for this purpose named InitiateSystemShutdown, but that API works only on Window 2000 and above. The ExitWindowEx API works directly in Win9x/ME, but in Windows multi-user systems, it requires a special privilege before execution. Here is the code for enabling that privilege for Windows multi-user platforms in Visual C++: Code: CPP
Code: CPP
1. EWX_LOGOFF: Logoff the current user. 2. EWX_RESTART: Simply restart the computer. 3. EWX_SHUTDOWN: Shut down but 'AT' style. 4. EWX_POWEROFF: Shut down but 'ATX' style. I think the above Win32 APIs are very simple, right? System Tray Icon : The next logical step to be understood is how to use the system tray icon and the way it handles the messages. First, I will show you the code, after that, I will describe to you the required details about the System Tray Icon handling. Code: CPP
Code: CPP
1. cbSize: this variable is created to provide compatibility with other versions of NotifyIconData. 2. hIcon: icon for the system tray. 3. hWnd: handle to window which will handle the system tray icon message. 4. szTip: show tip when mouse hovers over icon. 5. CallbackMessage: application-defined message identifier. The system uses this identifier to send notifications to the window identified in hWnd. These notifications are sent when a mouse event occurs in the bounding rectangle of the icon, or when the icon is selected or activated with the keyboard. 6. uFlag: this flag notifies the system which of the above variable to use or not. 7. uID: any unique ID for Icon. Now, Shell_NotifyIcon adds this icon to system tray. It takes three parameters as arguments: 1. NIM_ADD: add icon to system tray. 2. NIM_DELETE: delete icon from system tray. 3. NIM_MODIFY: modify the system tray icon (for e.g., when you connect to Yahoo! chat using Yahoo! messenger, the icon becomes active, and when you logoff, the icon becomes inactive). Handling the system tray message: Message Mapping: This notification is handled using MFC user defined messages . ON_MESSAGE(WM_USER+75,OnSystemBarMessage) Now, the code to handle message in MFC library ( Visual C++ ) is : Code: CPP
The Attchment contain the source of Project and a Executable |
Re: My Project:ShutDown Timer ver 1.0
Nice project and It looks good that people like you love to contibute in this community.
Thanks Shabbir Bhimani |
Re: My Project:ShutDown Timer ver 1.0
please Shabbir,
Mention Not and thanks iT's every programmer duty to help there fellow programmer and that the main reason behind creation Go4Expert.com. note:if time permit me,i will submit some more projectmade by me |
Re: My Project:ShutDown Timer ver 1.0
Hey Alok please see this for better looks that you can give to your posts as good as this thread.
http://go4expert.com/forums/misc.php?do=bbcode Thanks Shabbir Bhimani |
Re: My Project:ShutDown Timer ver 1.0
Nice application but I guess you can go for better looks though functionality is perfectly fine on my machine.
|
Re: My Project:ShutDown Timer ver 1.0
Yeah.
Thanks Shabbir for guiding me to VbCode,i will try to use them while submiting my post.thanks and for Coderzone:- i will try enhance look of Apllication,could you give me any suggestion for improving it. thanks Shabbir Amd CoderZone Alok |
Re: My Project:ShutDown Timer ver 1.0
Quote:
Better Image, Left, Right border, Always on top can be given depending on user choice. Properties, Time on same horizontal level to mention some. |
Re: My Project:ShutDown Timer ver 1.0
Quote:
|
Re: My Project:ShutDown Timer ver 1.0
Quote:
i will try improve Image quality,but adverse effect is that it will effect Application Size. And Other Idea are really Good,i will try improve it |
Re: My Project:ShutDown Timer ver 1.0
Quote:
|
| All times are GMT +5.5. The time now is 23:02. |