SECTION 3
Supporting Windows Applications
PEN*KEY
R
6200/6300 Hand-Held Computer Programmer’s Reference Guide 3-15
APM Event Broadcasts
The APM BIOS specification defines event codes for various APM events.
NORAPM.DLL collects these events from the APM BIOS and either handles
them directly or broadcasts them to the system components (Windows drivers,
applications, and DOS TSRs.) System components can use the events to monitor
system configuration and power state changes. Additionally, some APM events
have responses that can implement cooperative power management.
Definitions of the event codes are provided in the APMCODES.H C/C++ header
file, in
Appendix B, Common PEN*KEY 6000 Series Information
. In the header
file, each event is given two definitions, one for Windows and one for APM BIOS
and DOS APMĆaware TSRs. Two definitions are provided because the values
chosen by Microsoft to represent the APM events in the Windows 3.1
WINDOWS.H header file are different from the values defined in the
Intel/Microsoft APM BIOS Specification. In the APMCODES.H file, Windows
codes are identified by a prefix of
PWR_
" and BIOS/DOS codes start with
APM_.
"
Receiving APM Event Broadcasts
NORAPM.DLL broadcasts APM events to four classes of system components:
"
Windows Applications
Windows applications receive APM event broadcasts by means of the
message procedures of any topĆlevel windows that they own. The message
format is:
Msg:
WM_POWER
(defined in WINDOWS.H)
wParam:
PWR_*
event code defined in APMCODES.H or WINDOWS.H
lParam:
Optional NORAND 32Ćbit APM event parameter
Returns:
Application should return
PWR_FAIL
(from WINDOWS.H) if it wants to
reject an event; otherwise,
PWR_OK
should be returned.
"
Windows Installable Drivers
Windows installable drivers receive APM event broadcasts by means of
their
DriverProc
entry points. The message format is:
Msg:
DRV_POWER
(defined in WINDOWS.H)
lParam1:
PWR_*
event code defined in APMCODES.H or WINDOWS.H.
1Param2:
Optional NORAND 32Ćbit APM event parameter
Returns:
The driver should return
PWR_FAIL
or
PWR_OK
"
DOS RealĆMode Drivers and TSRs
DOS realĆmode system components receive APM event broadcasts through
software interrupt 2Fh. A driver or TSR that hooks the broadcast should
nest to previous owners of the interrupt before handling it, even if it is set
to fail the call. This approach allows other drivers an opportunity to see the
event, even if it is failed. The message format is:
AX:
530Bh, the APM event broadcast ID
BX:
APM_* event code defined in APMCODES.H.
CX:DX:
Optional 32Ćbit NORAND APM event parameter
Returns:
BX should be set to 0 for success or 80h to fail the event.
3. Windows
Applications