Ieee

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ieee as PDF for free.

More details

  • Words: 2,429
  • Pages: 4
Student Conference on Research and Development (SCOReD) 2003 Proceedings, Putraiaya, Malaysia

.

.

GUI for PC Auto-Shutdown Mohd. Liakot Ali, Fatimah bt Othtnan Department of Electrical and Electronic Engineering Faculty of Erigiginiering, Universiti Puba Malaysia 43400 UPM Serdang, Selangor, Malaysia e-mad: liakot(ii!enfi.opm.edu.mv, fatimah [email protected]

Abstract- This paper presents the development of graphical user interface (GUI) for auto-shutdown of personal Computer using Microsoft Visual Basic 6.0. The software monitors the status of power supply of the Personal Computer through peripherals device such as unintempted power supply (UPS). When the power goes out, the U P S will supply the power to the PC for a limited period of time. Before the UPS reaches its limit it will send a signal to the PC h o u g h Rs-232 serial port and the software will detect the signal and executes for saving all the programs opened by user and give the PC autoshutdown. An application programming interface ( M I ) h c t i o n is.used in the Visual Basic program, The s o h a r e developed in this project is capable of saving a11 the programs opened by the users and shutdown the PC safely when the power goes out. It saves from corruption of all software and hardware in the PC.

11.

SOFTWARE

*

.

Learn how to use Visual Basic 6.0 and be familiar with it. Collect information and data of the PC and peripherals. Design / draft the required software. Develop the program by using Visual Basic 6.0. Test the software in the PC with a signal. Make sure the program will operate with the peripheral’s signal. Analyze the operations and suggest recommendations.

111.

SYSTEM SOFTWARE

Below is the process on how the system software works:

Keywords Graphical User Interface (GUI), application programming interface (API), RS-232 serial port, MSComm control, privileges.

I.

PROCESS TO DEVELOP

..

INTRODUCTION

Personal Computer (PC) is a machine is found at home, office, school, and factory. The rapid spread of computer in society nowadays has both simplified and complicated our lives. Whether a PC at work or come in contact with one for other reasons can be rely on, most of us have used a PC at one point or another. If suddenly there is a power failure for the PC, normally the unsaved file will be closed and the PC is shutdown forcefully and the PC will be corrupted.

.

UPS sends a signal to the PC through RS-232 cable. All the files that are running in the windows are enumerated. The Visual Basic application will restore and minimized. The mouse pointer is hide to the bottom of the screen. All programs opened will be closed and virtual key will be sent to save all the files. When complete, the PC will shutdown. IV.

METHODS FOR CLOSING APPLlCATION

There are two methods to let the application shutdown properly before the operating system power off, If.it doesn’t shutdown properly the application may not release system resources and the operating system will not shut down. Users will have to use Ctd-Alt-Del to zap the application. [I].

This project consisted of developing a program of a graphical user interface GUI for data communication between personal computer (PC) and unintempted power supply Cups) through RS-232. The Visual Basic program accepts signal from one of several data communications included with the source code or from the UPS at run time for full compile. The intents were to provide a GUI that would simplify the program execution for the user. In the event of a blackout, this software will: Save open files, and close applications Shut down Windows

Method 1: A sub class is created that will monitor the system level messages from the operating system. The shutdown message is trapped and all database connections and open file handles are closed. A proper app close and exit are done. But if the have to worked with sub-classes there will be a very big problem Method 2: The sinvle but effective method. Hidden form is created, which will be the startup object. In the load event of this form it is called Sub Main 0. In

0-7803-8173-4/03/$17.00 02003 IEEE.

3 72

Authorized licensed use limited to: Sri Sivasubramanya Nadar College of Engineering. Downloaded on January 7, 2009 at 06:01 from IEEE Xplore. Restrictions apply.

Signal Common ..(pin 5 ) : This line brings the interconnecting devices to the same point of reference for zero volts.

unload or terhinate event of :this form it is cal!ed a shutdown procedure that will orderly close all connections, open file handles etc. The operating system sends a shutdown message to the application's main form when it is about to reboot, which will trigger the form's unload/texminate events. The few seconds between that and the actual attempted zapping of the application by the operating system is enough time to orderly close everything. V.'

RTS Request To Send (pin 7) - Request to Send is a data-flow control output that connects to the connecting device's Clear to Send (CTS) input. Typically, RTS and CTS are used to implement a hardware data-flow control. If used for flow control, the computer (DTE) places the RTS in the mark state, indicating to the remote device that it's ready to receive data. If the receive buffer of the DTE should be come full, a space is asserted on RTS instructing the interconnecting device to temporarily stop sending data.

VISUAL BASIC REVIEWS

Visual Basic objects have properties, method and events. Properties define the identity and state of an object. Methods and events define the behavior of a n object 121. Property: A named attribute of an object. Properties define object-oriented characteristics, such as size, color, screen location, or whether the object is eibled. Every Visual Basic object has a property called name. Event: An action recognized by an object, such as clicking the mouse or pressing a key. Code can be written to respond to events, Method A Subroutine or Function that operates on an object.

CTS Clear To Send (pin 8) - Clear to Send is a dataflow control input that is wired to the RTS of the

interconnecting device. CTS are a data-flow control companion to RTS. If a mark is asserted on CTS, the DTE wiIl continue to transmit data. Data transmission will be temporarily halted if a space i s detected on C T S . VIII,

MS COMM CONTROL

;

'

The MSComm control comes with Visual Basic. This one came with VISUAL BASIC 6.0. The MSComm control provides. serial communications for an application by allowing the transmission and reception of data through a serial port [4].

VI.

API . . . _.- . API (Advanced Programmers Interface) is a set of predefined Windows functions used to control the a p p e h n c e and behavior of every Windows element (from the outlook of the desktop window to the allocation of memory f0r.a new process). Every user action causes the execution of several or more API function telling Windows whafs happened. .

Event-driven communications is a very powerful method for 'handling serial port interactions. In many situations notify the moment an event takes place, such as when a character arrives or a change occurs in the Carrier Detect (CD) or Request To Send (RTS) lines. In such cases, use the MSComm control's OnComm event to trap and handle these communications events. The also detects and handles OnComm event communications errors. For a list of all possible events and communications errors, see the C o d v e n t property.

It is the codes that act as a shell to provide an automated and easier way to access MIS.It has completely hidden the MIS and provided a quite different approach for programming under Windows. Every line of code in Visual Basic is being translated by Visual Basic into API function and sent to Windows (either written in a code, or taken by some defaults). vD[.

,

Each MSComm control corresponds to one serial port. If needed to access more than one serial port in an application, use more than one MSComm control. The port address and intenupt address can be changed fiom the Windows Control Panel.

Rs-232 SERIAL PORT

T h e pins and associated fimctions foi a 9-pin D-type RS-232connector are illustrated above [3].

IX.

WIN CONNECTOR

DATACARRIER DETECT (WO) RECEWE DATA UNE (RD) TFlMSMIT DATALtNE (TO) DATATERMINALREADY (OTR) GROUND

' '

SHUTDOWN WINDOWS

On 9x machines shutting down Windows is as simple as calling the ExitWindowsEx function and passing it a flag telling Windows how to shut down. Windows can be instructed to shut down in a number of ways including shutting down all processes running and logging off the user (EWX-LOGOFF), shut down and restart the system (EWX-REBOOT), forcibly shut down the system without closing files resulting in possible data loss (EWX-FORCE) and shut down the

DATA SET READY (DSRJ

REQUEST TO SEND (RTS) CLEAR TO SEND ICTS) RING INOICATElRll

Fig. 1. RS-2329-Pin Connector Layout

373

Authorized licensed use limited to: Sri Sivasubramanya Nadar College of Engineering. Downloaded on January 7, 2009 at 06:01 from IEEE Xplore. Restrictions apply.

system to a point where it is safe to turn off the system (EWX-SHUTDOWN). On Windows NT and 2000 machines shutting .down windows is more involved. We must get thk$&ess token of the current process with the privilegeb of querying the access token and adjusting its privileges. The GetCurrentProcess h c t i o n returns the current process while the OpenProcessToken h c t i o n and TOKEN-ADJUST-PRIVILEGES and TOKEN-QUERY flags do the rest. Next we need to get the locally unique identifier (LUID) that represents the shutdown privilege. This is accomplished with the LookupPrivilegeValue function passing it the &quo;SeShutdownPrivilege" string. Once we have the locally unique identifier we can populate a Token-Privileges structure. We must allow the process to shut down the computer by setting the structure's Privi1eges.Attributes field to SE-PRIVILEGE-ENABLED. A call to AdjustTokenPrivileges passing it the newly populated Token-Rrivileges structure gives the application the right to shut down Windows.

Fig. 2. PC Power Status Monitor When the power goes out, the UPS will supply the power to the PC for a limited period of time. At the same time the UPS will send a signal to the PC through an RS-232 serial port. The software will get this signal and a waming will be shown that the PC will be shutdownas shown in Fig. 3. Once the signal is detected this software is minimized so that it will not be the top of the window and it will not closed first. The mouse cursor too will be restricted to the bottom of the window for the same purpose.

Finally, all that remains is a call to ExitWindowsEx as . described above [ 5 ] . X.

RESULTS AND DISCUSSION

Fig. 2 below shows that the Visual Basic application in a standby modes. It monitors the power status of the PC and standby for a signal from UPS through RS-232 serial port. Notice that apart from i t detects the version of the operating system; it aIso detects the number of files that are all opened by the user and the files that are running in the windows like anti-virus, system utility, system tray, etc. This number of opened windows is detected every 1000 interval i.e. every 1 second.

Let an application of Microsoft Word be an example for this project. When the user opens this Microsoft Word application, the number of opened windows will be added to the label that is provided in the Visual Basic

Fig. 3. Shutdown Dialog

application. The Fig. 2 shows that the user has typed something in the word document. If suddenly there is a power failure for the PC, normally the unsaved file will be closed and the PC is shutdown forcefidly and the PC will be corrupted. But with this software presented in this project, it will saves the file and close the Windows safely.

Then the execution of the file saving will begin. The word application, which is the top of the window, will be closed. Then a dialog window is shown asking for save the changes made as shown in Fig. 4. Most of the dialog window has a default behavior of Enter or Esc. An Enter key is send virtually and the word application is saved. This close and save are repeated until all the running application is closed.

3 74

Authorized licensed use limited to: Sri Sivasubramanya Nadar College of Engineering. Downloaded on January 7, 2009 at 06:01 from IEEE Xplore. Restrictions apply.

XI..

.CONCLUSION

The development of a GUI for auto-saving and autoshutdown PC is presented in this project. This software is developed using Microsoft Visual Basic under Windows Environment, In a Microsoft Visual Basic 6.0 program, a Microsoft Windows application programming interface (API) function is used to shut down the computer system. This project explains how to quit Windows and shut down the computer system. This software package uses MSComm component and a port of RS-232. MSComm is a user knowledge database. Through MSComm the engineers can simulate and study the computer system protection. This program can be tested with UPS and any other peripherals and can be generalized to monitor for all the activities done in the Personal Computer.

Fig. 4. Saving the Applications When all the &g application is closed, the Windows is safely shutdown. The Windows is shutdown automaticalIy with the default Enter key as shown in

XT.

Fig. S.

., 1

Fig. 5. Shutdownthe Wmdows .

-

t-

! ’ t

[ I ] Jack van Niekerk, “Let your application close orderly before the system reboot. Avoid hanging the O/S while‘your application is running and the user want’s to reboot”. [2] J. Dukovic and D. Joyce, “An Evaluation of ObjectBased Programming with Visual Basic”, IEEE [3] Thomas E. Leonik, Home Automation Basics: Practical Applications using Visual Basic 6.0, IN: Indianapolis-Prompt, 2000 [4] ONTRAK Control System, “Serial Data Acquisition & Control Interfaces”, www.ontrak.net, 1999. [SI The Scarms...“Visual Basic Code Library”, www.TheScarms.com. [6] DeitellDeitel, Visual Basic Programming, IDG Books Worldwide, 1998. [7] Jan Axelson, Serial Port Complete: Programming

-

and Circuits for RS-232 and RS-485 Links and Networks, USA: Lakeview Research, 1998.

:

~

REFERENCE

Fig. 6 shows the saved application when the power of the PC is back on and the Windows is running.

L,

Fig. 6. Saved Application

375

Authorized licensed use limited to: Sri Sivasubramanya Nadar College of Engineering. Downloaded on January 7, 2009 at 06:01 from IEEE Xplore. Restrictions apply.

Related Documents

Ieee
May 2020 64
Ieee
July 2020 52
Ieee
November 2019 70
Ieee-via
November 2019 63
Ieee 802
October 2019 55
Ieee Si.docx
April 2020 32