Reference - Epson IR-320 Technical Reference Manual

Hide thumbs Also See for IR-320:
Table of Contents

Advertisement

Reference

The following events occur when the front switches using the environment provided by this
driver are operated (Front Switch Operation) and the AC power error is detected (AC Fail):
1. Occurrence of AC Fail (AC Offline) event or Front Switch Operation
2. Notification of AC Offline Status caused by the APM BIOS
3. Acceptance of AC Offline Status Notify by the driver
4. Notification of WM_POWERBROADCAST from the driver to the application
5. Termination processing by the application itself
6. Execution of WinNT Shutdown by using the ExitWindowsEx function
7. Execution of Auto Power of the system by the APM BIOS after WinNT Shutdown
By using the WM_POWERBROADCAST notification from the driver, the processing can be
performed from the normal shutdown of Windows NT to the power off.
The following shows easy sample codes. In practical operation, the shutdown should be
performed after terminating all applications.
LRESULT CALLBACK WndProc(HWND hWnd, UINT Message, WPARAM wParam,
LPARAM lParam)
{
HWND
HBRUSH
HANDLE
OKEN_PRIVILEGES tkPriv;
UINT
switch(Message)
{
case WM_POWERBROADCAST:
OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES, &htkProcess);
tkPriv.PrivilegeCount = 1;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkPriv.Privileges[0].Luid);
tkPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(htkProcess, FALSE, &tkPriv, 0, NULL, NULL);
ExitWindowsEx(EWX_POWEROFF, 0);
break;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
}
return 0L;
Rev. C
hTmpWnd;
hTmpBrush;
htkProcess;
uFlags = EWX_SHUTDOWN;
IR-320 Technical Reference Manual
Utilities 4-75

Advertisement

Table of Contents
loading

Table of Contents