Intermec PENKEY 6100 Programmer's Reference Manual page 286

Hide thumbs Also See for PENKEY 6100:
Table of Contents

Advertisement

Common PEN*KEY 6000 Series Information
tagPOWER_STATUS PwrStat;
WORD Error;
char MsgBuf[100];
#pragma argsused
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
// Turn off the "File not found" error box.
SetErrorMode(SEM_NOOPENFILEERRORBOX);
// Get handle to NORAPM.DLL driver
hinstNorAPM = LoadLibrary("NORAPM.DLL");
// Did we find the library?
if (hinstNorAPM > HINSTANCE_ERROR) {
// Get Entry point for GetPowerStatus()
fpGetPowerStatus lpfnGetPowerStatus = (fpGetPowerStatus)
if (lpfnGetPowerStatus) {
} // then
else
// Free NorAPM instance.
FreeLibrary(hinstNorAPM);
} // then
else
MessageBox(NULL, "Could not open NORAPM.DLL!", szTitle,
MB_OK | MB_ICONEXCLAMATION);
// Exit application
return (0);
} // WinMain
Critical Error Handler: CRITICAL.C
#include "stdio.h"
#include "compat.h"
#include "4800.h"
extern
R
B-6
PEN*KEY
6100 Computer Programmer's Reference Guide
LPSTR lpCmdLine, int nCmdShow) {
GetProcAddress(hinstNorAPM, "GetPowerStatus");
// Get and display charge state
do {
Error = lpfnGetPowerStatus(&PwrStat);
if (Error != PWR_OK) {
wsprintf(MsgBuf,
"GetPowerStatus() call failed with result of %d", Error);
Error = MessageBox(NULL, MsgBuf, szTitle,
MB_RETRYCANCEL + MB_ICONEXCLAMATION);
} // then
else {
// Display battery status
wsprintf(MsgBuf, "A/C is %s line.\nBattery is %scharging\n",
(char far *)
(PwrStat.LineStatus == 1 ? "on" : "off"),
(char far *)
(PwrStat.BatteryFlags & 8 ? "" : "NOT "));
Error = MessageBox(NULL, MsgBuf, szTitle,
MB_RETRYCANCEL + MB_ICONINFORMATION);
} // else
} while (Error == IDRETRY);
MessageBox
(NULL, "Could not get entry point for GetPowerState()!",
szTitle, MB_OK | MB_ICONEXCLAMATION);
uchar jamarray[4][1024];
// Holds current power status.
// Holds error codes.
// Message buffer
It stays around since it was already open.
APPENDIX B

Advertisement

Table of Contents
loading

Table of Contents