The text of a manual · part 11 of 38
PEN*KEY 6100 Computer Programmer's Reference Guide: Section 3: Supporting Windows Applications, pages 87 to 95
Pages 87 to 95 of 328, from PEN*KEY 6100 Computer Programmer's Reference Guide
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Norand 6100
Page 87
SECTION 3
Supporting Windows Applications
FlipX Valid values:
0, 1
Default value:
0
Required value for 6100 Computer: 1 When nonzero, the XĆaxis values are inverted.
SYSTEM.INI Configuration Example for UCLKPEN.DRV The following is an example section of SYSTEM.INI, to configure the 6100 ComĆ puter with the default values for the Windows Pen Driver: [Pen Driver] ; Increase wOffsetX to move cursor down relative to pen. wOffsetX=696 ; Increase wOffsetY to move cursor to left relative to pen. wOffsetY=709 ; Increase wDistinctWidth to make cursor move slower relative to pen in the ; up/down direction on screen. wDistinctWidth=3504 ; Increase wDistinctHeight to make cursor move slower relative to pen in the ; left\right direction on screen. wDistinctHeight=3680 ; Sets initial digitizing rate (packets / second) ; Range: 1 200. ; Set to 120 150 if you install handwriting recognition. PointsPerSecond=135 ; Set to required value. PortAddr=512 ; Set to required value. IrqLevel=14 PenOrientation=3 FlipX=1 DoEOI=SMART UseNV=1 cxRawWidth=4500 cyRawWidth=3000 [Display Driver] DisplayOrientation=1
PENALIGN.EXE is the Windows penĆcalibration utility (with no parameters). There are two screens, the first prompts to tap three times in marked screen locations; the second prompts to overlay (match) the cursor and the pen position. Alternatively, you can set the calibration by adjusting the calibration entries in SYSTEM.INI. This is a fairly tedious approach that requires an understanding of digitizer orientation and digitizer coordinate systems. To enable use of the calĆ ibration entries in SYSTEM.INI, set the UseNV setting to 0.
Pen for Windows: PENWIN.DLL The Windows pen program, properly known as Microsoft Windows for Pen ComĆ puting, can be installed and used on the 6100 Computer. The Pen for Windows files are located on the fourth diskette in the Tool Kit. Place the PENWIN.DLL file into the WINDOWS\SYSTEM directory.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-19
3. Windows Applications
Windows Pen Calibration: PENALIGN.EXE
Page 88
Supporting Windows Applications
SECTION 3
Required SYSTEM.INI Entries [boot] drivers= power irda pen penwindows scanner npcp drivers= tells Windows to load the installable drivers. This list of drivers is the standard driver list. The significant driver is a token name for the driver. The actual driver name is in the SYSTEM.INI [drivers] section: [drivers] penwindows=PENWIN.DLL penwindows=PENWIN.DLL tells Windows the actual name of the installable driver named in the [boot] section of the SYSTEM.INI file (listed above). " NOTE:
A recognizer must be purchased and installed for this application to be useful. Intermec Technologies Corporation offers both CIC and Synaptics. Refer to the “Getting Started” section of this publication for information on handwriting recognition.
Required PENWIN.INI Entries This is a sample PENWIN.INI file to use with Windows 3.1 on a 6100 Computer: [Current] User=User 1 InkWidth=1 InkColor=0 SelectTimeout=500 [*User 1] TryDictionary=100 ErrorLevel=25 EndRecognition=8000 TimeOut=500 WriteDirection=103 MenuDropAlignment=0 Preferences=0 IntlPreferences=0 Recognizer=mars.dll
3. Windows Applications
[Dictionary List] MAINDICT.DLL= [Recognizer List] MARS.DLL= [MsSpell] MSSPELL.DLL= [MsMainDict] enuMain= [User List] User 1= [sysges] C!=xx,0,{Ctrl}{Ins} P!=xx,0,{Shift}{Ins} X!=xx,0,{Shift}{Del} U!=xx,0,{Alt}{Bs} [Pen Palette] SKBPos=15 92 [MS–DOS] EnableMSDOS=1 3-20
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 89
SECTION 3
Supporting Windows Applications
Integrated Scanner: 61SCAN.DRV This is a Windows driver. NORAND integrated scanner support consists of two basic components: " "
61SCAN.DRV -- Windows device driver. SYSTEM.INI -- file containing scannerĆspecific configuration information.
Installation Place the scanning files in the following directories: File SYSTEM.INI NORWINPM.DRV 61SCAN.DRV " NOTE:
Directory \windows \windows\system \windows\system
NORWINPM.DRV needs to be loaded before 61SCAN.DRV.
The Windows scan driver, 61SCAN.DRV, currently supports the Pod scanner.
Configuration SYSTEM.INI Entries The following entry is required In the SYSTEM.INI file. It allows the opening and closing of the scanner by an application. [boot] drivers=power irda pen penwindows scanner npcp where:
The actual driver name is specified in the following [drivers] section of the SYSTEM.INI file: [drivers] scanner=61SCAN.DRV scanner=61SCAN.DRV tells Windows the actual name (61SCAN.DRV) of the installable driver named in the preceding [boot] section of the SYSTEM.INI file.
Entries in [scanner driver] Section of SYSTEM.INI [Scanner Driver] ScannerHardwareType=PEN*KEY MessageBeepScanVerification=INTERNAL MessageBeepStatusNotification=INTERNAL MessageBoxStatusNotification=TRUE EnableScannerWhenDriverLoads=FALSE DisplayScanningDataDialog=TRUE ShowWindowOnLoad=TRUE EnableScanCodes=TRUE ;ScanKey = nnn ExternalFlashOnScan=FALSE AimingBeamDuration=0 PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-21
3. Windows Applications drivers= tells Windows to load the installable drivers. This list of drivers is the standard driver list (in the order that it needs to be). The significant driver here, is scanner. This is just a token name for the driver.
Page 90
Supporting Windows Applications
SECTION 3
ScannerHardwareType: Controls the type of hardware the scanner is using. This value must be set or the driver does not load. There is no default value. Valid values are PEN*KEY/33, PEN*KEY, and TETHERED. MessageBeepScanVerification: Controls the type of beep generated when a good scan is obtained. Valid values are OFF, INTERNAL, EXTERNAL, and ALL. ALL has the same effect as both internal and external. MessageBeepStatusNotification: Controls the type of beep generated when a staĆ tus change occurs. Valid values are OFF, INTERNAL, EXTERNAL, and ALL. ALL has the same effect as both internal and external. MessageBoxStatusNotification: Controls whether or not a message box is generĆ ated when a status change occurs. Valid values are TRUE and FALSE. EnableScannerWhenDriverLoads: Controls conditions under which the scanner is enabled. Valid values are TRUE and FALSE. If this parameter is set to TRUE, the following conditions are in effect: The scanner is enabled when it is loaded by Windows, and is always active until Windows shuts down. " Scanned data is directed to the keyboard buffer, so applications can pick up scanned data as if it had been input through the keyboard. " OpenDriver and CloseDriver calls are not required to be issued by the apĆ plication to use the scanner. " Multiplexing of the scanner and external COM2 connections is not allowed. " This option uses more power. DisplayScanningDataDialog: Controls whether or not the Scanning Data... diaĆ log is displayed when the trigger is pulled. Valid values are TRUE and FALSE. "
ShowWindowOnLoad: Controls whether or not the scanner window icon is disĆ played on the screen. If this is FALSE, it is not possible to get to the scanner window. Valid values are TRUE and FALSE. EnableScanCodes: Controls whether or not the scanner includes Scan Codes in the key messages that it generates. Valid values are TRUE and FALSE. 3. Windows Applications
ScanKey: is the hexadecimal scan code value for the key to fire the scanner (i.e., you can program the key to fire the scanner). ExternalFlashOnScan: Controls whether the Good Scan light is flashed manualĆ ly by the scanner driver when the data is received. Valid values are TRUE and FALSE. AimingBeamDuration: Controls the length of time (in milliseconds) that a longĆ range scanner using a dedicated UART emits an aiming beam. All other scanĆ ners should have this option set to 0 (the default value).
Usage Because the integrated scanner has its own dedicated UART, the communicaĆ tions with the scanner are completely separated from the external communicaĆ tions ports on the 6100 Computer. When an OpenDriver is issued to the scanner, the dedicated UART hardware is initialized. When the CloseDriver call is issued, the scanner driver closes the dedicated UART communications hardware. Any application multiplexing with the inteĆ grated scanner is required to the UART hardware, to initialize it at a latĆ er time when communications to the scanner is needed. 3-22
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 91
SECTION 3
Supporting Windows Applications
An example of an OpenDriver call is as follows: hDRVR = OpenDriver(“61SCAN.DRV”, (LPCSTR)NULL, (LPARAM)NULL);
The scanner is powered on, and scanner data is delivered to the application with the input focus as WM_CHAR messages. These messages are distinguishable from WM_CHAR messages in that the virtual key code in wParam is the ASCII value of a scanned character and lParam is sent as 0x00000000 (in particular, the OEM nibble (bits 16ć23) that contains the OEM scan code of 0). An example of an CloseDriver call is as follows: CloseDriver(hDRVR, (LPARAM)NULL, (LPARAM)NULL);
This turns the scanner off. " NOTE:
See the Borland C++ help for OpenDriver / CloseDriver. See also Windows 3.1 SDK for additional information.
NPCP Printing for Windows: NOR4800.DRV, UNIDRV.DLL NPCP printing support under Windows consists of DOS device driver NORNPCP.SYS, a DOS TSR NORPAPI.EXE, and Windows printer driver NOR4800.DRV/UNIDRV.DLL. These device drivers work together to provide transparent NPCP printing. Applications use the standard Windows printing API (StartDoc(), EndDoc(), etc.) to print to a printer set up for LPT1.DOS output.
Installation Place the files in the following directories: Directory WINDOWS\SYSTEM WINDOWS\SYSTEM WINDOWS\SYSTEM
3. Windows Applications
File NORNPCP.DRV NOR4800.DRV UNIDRV.DLL
Configuration Required WIN.INI Entries [windows] spooler= DosPrint=no device=NORAND 4800 Series,NOR4800,LPT1.DOS where: spooler= tells Windows not to use Print Manager to spool printing. DosPrint=no tells Windows not print directly to the printer port. device=NORAND 4800 Series,NOR4800,LPT1.DOS specifies the default printer for Windows. See the following [PrinterPorts] and [devices ] sections of the
WIN.INI file.
[PrinterPorts] NPCP Printer=NOR4800,LPT1.DOS,15,45 PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-23
Page 92
Supporting Windows Applications
SECTION 3
NPCP Printer=NOR4800,LPT1.DOS,15,45 tells Windows that there is a printer named NPCP Printer that uses the NOR4800 printer driver to print, using the DOS device LPT1 with 15Ćsecond device timeĆout and 45Ćsecond retry timeĆout. [devices] NPCP Printer=NOR4800,LPT1.DOS
NPCP Printer=NOR4800, LPT1.DOS tells Windows that there is a printer named NPCP Printer that uses the NOR4800 printer driver to print, using the DOS device LPT1. This section is included for compatibility with older Windows applications and should match the entry in the [PrinterPorts] section of the WIN.INI file (listed above).
Required SYSTEM.INI Entries [boot] drivers=power irda pen penwindows scanner npcp drivers= tells Windows to load the installable drivers. This list of drivers is the standard driver list (in the order that it needs to be). The significant driver here, is npcp. This is just a token name for the driver. The actual driver name is speĆ cified in the following [drivers] section of the SYSTEM.INI file: [drivers] npcp=nornpcp.drv npcp= tells Windows the actual name of the installable driver named in the [boot] section of the SYSTEM.INI file (listed above). [NPCP Driver] PrtPort= 0 deviceName=LPT1 CommAddress=0x318 CommVector=0x0C FIFODepth=16
PrtPort= PrtPort specifies the printer port to use; 0=LPT1, 1=LPT2, 2=LPT3. This option must match the options set in the CONFIG.SYS file and the WIN.INI file (above). deviceName= name of printer device to output to (LPT1, LPT2, or LPT3). 3. Windows Applications
ComAddress= Communications port address. ComVector= Communications IRQ vector. FIFODepth= Determines FIFO usage on UART.
Usage Communications Port Usage The NPCP printer driver uses COM1 communication hardware directly. The COM1 hardware is initialized and the external RS-232 driver hardware is powĆ ered on, thus allowing the driver a and clean" data path to the printer. This makes it necessary to be careful when sharing the COM1 hardware with any other driver. Currently, there is no method of arbitrating COM1 access, so drivers must be enabled and disabled only when they are needed. This means that printing in the background and trying to use another driver that talks to the COM1 hardware causes undetermined problems.
3-24
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 93
SECTION 3
Supporting Windows Applications
Basic Windows Printing Once Windows is loaded, printing is accomplished through the standard printing API. No special processing by the application is needed. The following sequence demonstrates the correct method for printing under Windows: 1. Create a device context for the printer. GetPrinterDC() creates the device context. 2. Set up the device context with the desired fonts, etc. Keep in mind that difĆ ferent fonts cause Windows to print completely in graphics mode, which may provide less performance than desired. SelectObject(...) sets the deĆ sired font. 3. Set an abort procedure to handle errors during printing and allow the user to cancel the print job. SetABortProc(...) sets an abort procedure. 4. Begin the printing operation by calling StartDoc(...) to inform GDI that you want every output to be one job. 5. Begin each page of output by calling StartPage(...) to allow GDI to begin sending data to the printer on a pageĆbyĆpage basis. 6. Create your page using standard GDI API like TextOut(...). The output opĆ erations used take text and other objects and convert them into a binary data stream that contains printerĆspecific escape codes. This data is until the entire page is composed. 7. Use EndPage(...) to finish off a page. The entire page is then sent to the printer. A form feed is generated to move the paper to the top of the next page. 8. Use EndDoc() to complete the printing operation. AbortDoc() can cancel a job. GDI cleans things up, if possible. 9. Free the instance of your abort procedure using FreeProcInstance(...). Refer to the Windows SDK manual for more API information.
Default Error Handling Mode
Application-Defined Error-Handling Mode This is probably the most common mode of operation. In this mode, the applicaĆ tion can link to the NPCP driver in the same manner that it would link to any Windows DLL. Once linked, the application can use the driver's API to perform various operations. The application registers a callback with the driver. The apĆ plication needs to perform the following actions to define a new error handler: 1. Link to driver and obtain PrtService entry point. 2. Call PrtService to enable the driver using PRT_ENABLE (0x0001). 3. Call PrtService to register the new handler using PRT_SETPROC (0x0010) and the address of the new handler. The new handler should have the following prototype: extern “C” WORD _export FAR PASCAL ShowPrtError (WORD wCurErr) PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-25
3. Windows Applications
Once the drivers are loaded as defined above, no special processing by the apĆ plication is needed. This makes it possible for offĆtheĆshelf packages to take adĆ vantage of NPCP. In this mode, all printerĆrelated errors are handled by the NPCP driver. A message is displayed and the user has the ability to Cancel or Retry. If the user selects Retry, the driver attempts to continue printing. If the user selects Cancel, the driver attempts to clean up as best it can. The standard Windows API returns a standard error, indicating that a problem occurred. This is the application's signal to abort the print job.
Page 94
Supporting Windows Applications
SECTION 3
This callback is called for each error and must return IDCANCEL (0x02), IDRETRY (0x04), or 0. If the application returns 0, the default handler processes the error. For consistency, the application should handle all the errors. You can use any method for displaying the message you want. It is best to make your dialog model if possible. Remember that, depending on the method of displaying the message, you may need to translate the return values into IDCANCEL or IDRETRY so the printer driver knows how to deal with it. See the Error Codes and Messages topic later in this subsecĆ tion for the various error conditions that can occur. 4. Perform normal printing operations. 5. Call PrtService to remove the error handler, using PRT_SETPROC (0x0010) and a NULL value for the handler address. 6. Call PrtService to disable the driver, using PRT_DISABLE (0x0002). See the following Printer Services API topic for more information about available printer services.
Printer Services API The NPCP printer driver includes an Applications Program Interface (API) to provide access to the features of the NPCP driver that are not available through the standard Windows API. Retrieving the API Entry Point PrtService
To use the API, the application must first obtain the entry point for the PrtService procedure as described in the following code fragment:
3. Windows Applications hInstNorPrnt = LoadLibrary( “NORNPCP.DRV” ); if ( hInstNorPrnt <= HINSTANCE_ERROR ) { MessageBox( NULL, “Could not open printer driver.”, “ERROR”, MB_OK | MB_ICONEXCLAMATION ); return FALSE; } lpfnPrtService = (fpPrtService)GetProcAddress(hInstNorPrnt, “PrtService”); if ( lpfnPrtService == NULL ) { MessageBox( NULL, “Unable to get address for\nPrtService”, “ERROR”, MB_OK | MB_ICONEXCLAMATION ); return FALSE; } Calling PrtService
NORNPCP.DRV contains an exported procedure PrtService (HINSTANCE hInst, WORD wOpt, LPARAM lParam1, LPARAM lParam2) that provides the API for the driver. The parameters to the procedure are as follows: HINSTANCE hInst WORD wOpt LPARAM lParam1 LPARAM lParam2 3-26 instance handle to our application. option for action you want to perform. doubleword that depends on the particular option. doubleword that depends on the particular option.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 95
SECTION 3
Supporting Windows Applications
The value returned by PrtService depends on the option selected. See specific options for more details. The entry point can be called just like any Windows procedure, as shown in the following fragment: if ( lpfnPrtService (hInst, PRT_ENABLE, (LPARAM)NULL, (LPARAM)NULL) < 1) { MessageBox( NULL, ”Unable to enable printer driver”, ”ERROR”, MB_OK | MB_ICONEXCLAMATION ); return FALSE; }
Supported PrtService Options
PrtService provides the following services: "
"
"
"
"
"
Disable Driver: Disables the driver. wOpt should be PRT_DISABLE (0x0002) lParam1 should be 0 lParam2 should be 0 Query Driver for support of an option: Determines whether the driver supĆ ports a particular feature. wOpt should be PRT_GETSUPPORT (0x0003) lParam1 should be the value of the option you want to check. lParam2 should be 0 Install/Remove External Error handler: Installs or removes the applicaĆ tions error handler. wOpt should be PRT_SETPROC (0x0010) lParam1 should be far pointer to your error handling procedure. A value of 0 removes the handler. Call MakeProcInstance(...) to obtain the value. lParam2 should be 0 Flush Driver: Flushes all the data buffers so that everything that has been sent to the printer actually gets printed. wOpt should be PRT_FLUSH (0x0020) lParam1 should be 0 lParam2 should be 0 Forward: Advances the paper a certain number of lines. Use this option with caution because Windows is not aware of the paper movement. wOpt should be PRT_FORWARD(0x0030) lParam1 should be the number of lines to advance lParam2 should be 0 Rewind: Rewinds the paper back into the printer a certain number of lines. Use this option with caution because Windows is not aware of the paper movement. It may also cause a head jam. wOpt should be PRT_REVERSE(0x0040) lParam1 should be the number of lines to advance lParam2 should be 0 PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-27
3. Windows Applications
"
Enable Driver. Enables the driver and installs the default error handler. wOpt should be PRT_ENABLE (0x0001) 1Param1 should be 0 1Param2 should be 0