Documente Academic
Documente Profesional
Documente Cultură
. .
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 o@inailcity.com
Authorized licensed use limited to: Sri Sivasubramanya Nadar College of Engineering. Downloaded on January 7, 2009 at 06:01 from IEEE Xplore. Restrictions apply.
unload or terhinate event of :this form it is cal!ed a Signal Common ..(pin 5 ) : This line brings the
shutdown procedure that will orderly close all interconnecting devices to the same point of reference
connections, open file handles etc. The operating system for zero volts.
sends a shutdown message to the application's main
form when it is about to reboot, which will trigger the RTS Request To Send (pin 7) - Request to Send is a
form's unload/texminate events. The few seconds data-flow control output that connects to the connecting
between that and the actual attempted zapping of the device's Clear to Send (CTS) input. Typically, RTS and
application by the operating system is enough time to CTS are used to implement a hardware data-flow
orderly close everything. control. If used for flow control, the computer (DTE)
places the RTS in the mark state, indicating to the
V.' VISUAL BASIC REVIEWS remote device that it's ready to receive data. If the
receive buffer of the DTE should be come full, a space
Visual Basic objects have properties, method and is asserted on RTS instructing the interconnecting
events. Properties define the identity and state of an device to temporarily stop sending data.
object. Methods and events define the behavior of a n
object 121. CTS Clear To Send (pin 8) - Clear to Send is a data-
Property: A named attribute of an object. Properties flow control input that is wired to the RTS of the
define object-oriented characteristics, such as size, interconnecting device. CTS are a data-flow control
color, screen location, or whether the object is companion to RTS. If a mark is asserted on CTS, the
eibled. Every Visual Basic object has a property DTE wiIl continue to transmit data. Data transmission
called name. will be temporarily halted if a space i s detected on C T S .
Event: An action recognized by an object, such as
clicking the mouse or pressing a key. Code can be VIII, ;MS COMM CONTROL
'
written to respond to events,
Method A Subroutine or Function that operates on The MSComm control comes with Visual Basic. This
an object. one came with VISUAL BASIC 6.0. The MSComm
control provides. serial communications for an
VI.API application by allowing the transmission and reception
. .
. . _.- . of data through a serial port [4].
API (Advanced Programmers Interface) is a set of
predefined Windows functions used to control the Event-driven communications is a very powerful
a p p e h n c e and behavior of every Windows element method for 'handling serial port interactions. In many
(from the outlook of the desktop window to the situations notify the moment an event takes place, such
allocation of memory f0r.a new process). Every user as when a character arrives or a change occurs in the
action causes the execution of several or more API Carrier Detect (CD) or Request To Send (RTS) lines. In
function telling Windows whafs happened. such cases, use the MSComm control's OnComm event
to trap and handle these communications events. The
It is the codes that act as a shell to provide an automated OnComm event also detects and handles
and easier way to access MIS.It has completely hidden communications errors. For a list of all possible events
the MIS and provided a quite different approach for and communications errors, see the C o d v e n t
programming under Windows. Every line of code in property.
Visual Basic is being translated by Visual Basic into
API function and sent to Windows (either written in a Each MSComm control corresponds to one serial port.
code, or taken by some defaults). If needed to access more than one serial port in an
application, use more than one MSComm control. The
vD[. Rs-232 SERIAL PORT port address and intenupt address can be changed fiom
the Windows Control Panel.
T h e pins and associated fimctions foi a 9-pin D-type
, RS-232connector are illustrated above [3]. IX. SHUTDOWN WINDOWS
WIN CONNECTOR
On 9x machines shutting down Windows is as simple as
calling the ExitWindowsEx function and passing it a
DATACARRIER DETECT (WO)
flag telling Windows how to shut down. Windows can
RECEWE DATA UNE (RD) ' DATA SET READY (DSRJ be instructed to shut down in a number of ways
REQUEST TO SEND (RTS)
TFlMSMIT DATALtNE (TO) '
including shutting down all processes running and
DATATERMINALREADY (OTR) CLEAR TO SEND ICTS)
RING INOICATElRll logging off the user (EWX-LOGOFF), shut down and
GROUND
restart the system (EWX-REBOOT), forcibly shut
down the system without closing files resulting in
possible data loss (EWX-FORCE) and shut down the
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).
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
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.