FieldSoftware
Home

PrinterCE SDK
   General Info
   Download
   Purchase & Pricing

Developer Info
   eVC MFC
   eVC C/C++
   eVB

Special Features
   AsciiCE
   PrintDC
   BarcodeCE

Documentation
   PrinterCE SDK
   AsciiCE
   PrintDC
   BarcodeCE

Special Topics
  Supported Printers
  Bluetooth Printing
  Network Printing

.Net CF C# or VB.Net:
  PrinterCE.NetCF SDK

-----------------------------

Software Developers
  PrinterCE SDK
 
PrinterCE.NetCF SDK
  PocketHTMLprint SDK

Printing Utilities
  PrintPocketCE
  PIEprint
  PocketPixPrint
  PocketShot
 
PocketClipPrint

 Arcade Games
  SockOut
  MazeCraze

Contact Info

AsciiCE2 Developer's Guide
Library Name : AsciiCE2
DLL Name : PrEngineCE.dll
Control Name: PrEngineCE.AsciiCE2  

Download Word Doc copy of this Developer's Guide

The AsciiCE2 control is included with PrinterCE SDK and provides for sending and receiving ASCII text strings and blocks of data or control functions between printers and Windows CE / Pocket PC devices. When used with certain printers that also feature magnetic card readers or smart card readers, the AsciiCE2 control provides methods to read the data from those readers.

AsciiCE2 provides basic high-speed text output to ASCII printers, direct printer control and reading data sent from the printer, but loses the sophisticated graphics, TrueType font, object drawing and barcode printing capabilities of PrinterCE. AsciiCE2 and PrinterCE can be used simultaneously to a limited degree. AsciiCE2 functions can be accessed from eVB, MFC/CE and C++.

Note: AsciiCE2 extends PrinterCE's  original AsciiCE control. AsciiCE will continue to be found in PrinterCE unchanged, so all existing applications using AsciiCE will work as before. However AsciiCE2 provides every method and property of AsciiCE plus many more.

AsciiCE2 Information and Code Samples

Important Note for MFC Developers:: There is a known bug in MFC when inserting components using the Components and Controls Gallery that causes incorrect "wrapper classes" to be generated for methods that pass BYTE or BYTE* parameters (see MSDN Q241862). Two AsciiCE2 methods ("Read" and "Write") pass blocks of data through BYTE arrays. If your application uses these methods, click on the following links to download corrected "asciice2.h" and "asciice2.cpp" files and copy these into your MFC app's directory, overwriting the files that MFC created for you.   [Download asciice.h]       [Download asciice.cpp]

 

AsciiCE2 Methods & Properties

About
[AsciiCE2]

READ-ONLY property returns string describing this version of PrinterCE/AsciiCE2/BarcodeCE.

MFC Syntax: Cstring str =AsciiCE2a.GetAbout();

C++ Syntax: AsciiCE2a.get_About(BSTR* str);

eVB Syntax: str=AsciiCE2a.About

 

Returns

String describing this version of PrinterCE - including information on WinCE platform (Pocket PC, HPC/Pro and 2000), processor type and version. This string can be used in a MsgBox() to display the information.  

Capabilities
[AsciiCE2 & AsciiCE]

READ-ONLY property returns bit-values that identify all the capabilities in the current control.  

MFC Syntax:   long bitvals =AsciiCE2a.GetCapabilities();

C++ Syntax:    AsciiCE2a.get_Capabilities(long * bitvals);

eVB Syntax: bitvals = AsciiCE2a.Capabilities

Returns

Bit values that identify the capabilities of the current control:

Constant

Setting

Description

CAPS_STD

01h

PrinterCE Standard capabilities

CAPS_PLUS

02h

PrinterCE SDK

CAPS_ASCII

04h

AsciiCE

CAPS_BARCODE

08h

BarcodeCE

Char
[AsciiCE2 & AsciiCE]

This method sends single character byte value to the printer.

MFC Syntax:     AsciiCE2a.Char(long ch);

C++ Syntax:     AsciiCE2a.Char(long ch);

eVB Syntax:  AsciiCE2a.Char ch

Parameters

ch - character to be sent to printer  

ClosePort
[AsciiCE2 & AsciiCE]

Closes printer connection used by AsciiCE. This should be called at the end of each Ascii print job.

MFC Syntax:    AsciiCE2a.ClosePort();

C++ Syntax:     AsciiCE2a.ClosePort();

eVB Syntax:  AsciiCE2a.ClosePort  

CrLf
[AsciiCE2 & AsciiCE]

This method sends CR (carriage return Ascii 13) and LF (linefeed Ascii 10) commands to the printer. Some Ascii printers are set up to automatically insert a LF with any CR... in this case, just use Char() operation to send a LF command (ie. Ascii.Char(13))

MFC Syntax:   AsciiCE2a.CrLf();

C++ Syntax:  AsciiCE2a.CrLf();

eVB Syntax: AsciiCE2a.CrLf  

FormFeed
[AsciiCE2 & AsciiCE]

This method sends a FF (formfeed Ascii 12) to the printer to print everything sent for this page and eject the page. If FormFeed is not called at the end of a print job, the printed page will often be left half printed in the printer.

MFC Syntax:            AsciiCE2a.FormFeed();

C++ Syntax:            AsciiCE2a.FormFeed();

eVB Syntax:            AsciiCE2a.FormFeed  

GetVersion
[AsciiCE2]

READ-ONLY Property - Returns an integer value representing the version of the control

MFC Syntax: long value =AsciiCE2a.GetGetVersion();

C++ Syntax:  AsciiCE2a.get_GetVersion(long * value);

eVB Syntax: value = AsciiCE2a.GetVersion

Returns

value - Integer representation of version = (Major * 1000) + Minor.
Example: version 1700 would return value of 1700.

Init
[AsciiCE2 & AsciiCE]

This method registers AsciiCE with the application's RegID string to verify that the app is licensed to use the printer functions.This is identical to PrinterCE's Init() method. Once either Init method has been invoked by either PrinterCE or AsciiCE it is not necessary to call either one again during this use of the control.

MFC Syntax: long retval=AsciiCE2a.Init(BSTR regidstring);

C++ Syntax:  AsciiCE2a.Init(BSTR regidstring,long* retval);

eVB Syntax: AsciiCE2a.Init regidstring

Parameters

regidstring - the 10 digit registration id provided when the PrinterCE/AsciiCE license is purchased. This will identify which version of PrinterCE is licensed and permit all licensed functions to work.

retval - a boolean return value - True if registration was successful, false otherwise.

Remarks

If Init() is not called or is not successful, then the registry is queried to see if the user has registered a single-use license. If not, then an "evaluation" version (30-day time limit) allows the user to continue printing.

Peek
[AsciiCE2]

Returns number of data bytes currently available for reading from the printer port.

MFC Syntax:    long retval=AsciiCE2a.GetPeek();

C++ Syntax:    AsciiCE2a.get_Peek(long* retval);

eVB Syntax: retval=AsciiCE2a.Peek

Parameters

retval - number of data bytes available. 

PrDialogBox
[AsciiCE2]

This method controls action of the "Printing in progress" dialog box (which allows the user to cancel the print operation).

MFC Syntax:    long retval=AsciiCE2a.PrDialogBox(long operation);

C++ Syntax:    AsciiCE2a. PrDialogBox(long operation,long* retval);

eVB Syntax: retval=AsciiCE2a. PrDialogBox operation

Parameters

operation – One of the following values:

Constant

Setting

Description

vbDlgBoxDebugOn

-1

Uses "in progress" dialog box to show details about internal mode of PrinterCE during printing. 
(Off by default).

vbDlgBoxDebugOff

-2

Turns off Debug mode. 

vbDlgBoxUp

0

Display "in progress" dialog box

vbDlgBoxDown

1

Take down dialog box

vbDlgBoxDisable

2

Prevent dialog box from being used

vbDlgBoxStatus

3

Get status of printing operation

vbDlgBoxUserCancel

4

Return True if user cancelled printing operation

vbDlgBoxAbortError

5

Return True if an error aborted printing operation

Return Value

retval - Current status of operation (see table above). If not user cancel or AbortError, then returns current status of printer dialog box (vbDlgUp, etc).

Remarks

By default, the "Printing in progress" dialog box is displayed with the first call by an application to most PrinterCE or AsciiCE2 operation (such as SelectPort). This dialog box will remain until ClosePort completes the printing job. Calling PrDialogBox(vbDlgDisable) will prevent AsciiCE2 from displaying the dialog box (and will not give the user any chance to cancel).

See PrDialogBoxText() for info on changing the text displayed or language used by this dialog.

PrDialogBoxText
[AsciiCE2]

This method allows changing the text displayed or language used by the "Printing in progress" dialog box.

MFC Syntax:     AsciiCE2a.PrDialogBoxText(BSTR MainStr,BSTR TitleStr,BSTR CancelBtnStr);

C++ Syntax:     AsciiCE2a. PrDialogBoxText(BSTR MainStr,BSTR TitleStr,BSTR CancelBtnStr);

eVB Syntax:  AsciiCE2a. PrDialogBoxText MainStr,TitleStr,CancelBtnStr

Parameters

MainStr - String for main text portion of the "Printing in progress" dialog box.
TitleStr - String for title portion of the "Printing in progress" dialog box.
CancelBtnStr - String for Cancel Button portion of the "Printing in progress" dialog box 

Remarks

The text of this dialog box may be changed at any time… if the dialog box is already displayed, it will be taken down, the new text added, and then the dialog box will be redisplayed. If the dialog box is not currently displayed, it will remain down until a call to PrDialogBox() or until the AsciiCE2 automatically displays it.  

ReadChar
[AsciiCE2]

Reads a single character from the printer port. If no data is available, then returns -1.

MFC Syntax: short bval=AsciiCE2a.ReadChar();
C++ Syntax: AsciiCE2a.ReadChar(short* bval);
eVB Syntax: bval=AsciiCE2a.ReadChar

Parameters

bval - Data byte read. If no data available, returns -1.

Read
[AsciiCE2]

Reads a block of data from the printer port. This can be useful for special-purpose printers, such as combination printer & magnetic card reader or smart card reader devices (see printer selections). Note that AsciiCE2 supports infrared devices via IrLPT connections and will only read data if the printer can send it using the IrLPT protocol.

Note: Generally, the application will use AsciiCE2's Write, WriteVar or Text methods to send commands to the printer that enables the data-gathering portion of that device to collect and send the data to be read.

MFC Syntax: AsciiCE2a.Read(long MaxBytes, long LastChar, long ModeFlags, long TimeToWait,
                             long* ResultFlags,long* BytesRead,BYTE* buffer);
C++ Syntax: AsciiCE2a.Read(long MaxBytes, long LastChar, long ModeFlags, long TimeToWait,
                             long* ResultFlags,long* BytesRead,BYTE* buffer);
eVB Syntax: None (see ReadVar method). 

Parameters

MaxBytes - Maximum number of bytes to read.
LastChar - Optional - read data stream until this byte value is found, then return all data read.
ModeFlags - Defines following modes:
    READMODE_NORMAL = 0 - Reads all data into buffer
    READMODE_FLUSHZEROS = 1 - Ignores zero value bytes - all other data is read into buffer
TimeToWait - Maximum number of microseconds to wait for data from the printer. If 0, don't time out.

ResultFlags - Returns results of block read:
     READRESULT_ERR = 0 - Error trying to read (such as loss of infrared connection)
     READRESULT_OK = 1 - Read was successful
     READRESULT_FULLBUFFER = 2 - Returning because "MaxBytes" bytes were read
     READRESULT_TIMEOUT = 3 - Returning because "TimeToWait" microseconds expired
     READRESULT_USERCANCEL = 4 - User cancelled
BytesRead - Returns actual number of bytes read into buffer
buffer - data buffer containing the bytes read
 

ReadVar
[AsciiCE2]

Identical to Read() - except that the data read is returned in a VARIANT array. This is the preferred method for eVB to read.

MFC Syntax: VARIANT* buffer=AsciiCE2a.ReadVar(long MaxBytes, long LastChar, long ModeFlags, 
                             long TimeToWait,long* ResultFlags,long* BytesRead);
C++ Syntax: AsciiCE2a.ReadVar(long MaxBytes, long LastChar, long ModeFlags, long TimeToWait,
                             long* ResultFlags,long* BytesRead,VARIANT* buffer);
eVB Syntax: buffer = AsciiCE2a.ReadVar MaxBytes, LastChar, ModeFlags, TimeToWait,
                             ResultFlags,BytesRead

Parameters

MaxBytes - Maximum number of bytes to read.
LastChar - Optional - read data stream until this byte value is found, then return all data read.
ModeFlags - Defines following modes:
    READMODE_NORMAL = 0 - Reads all data into buffer
    READMODE_FLUSHZEROS = 1 - Ignores zero value bytes - all other data is read into buffer
TimeToWait - Maximum number of microseconds to wait for data from the printer. If 0, don't time out.

ResultFlags - Returns results of block read:
     READRESULT_ERR = 0 - Error trying to read (such as loss of infrared connection)
     READRESULT_OK = 1 - Read was successful
     READRESULT_FULLBUFFER = 2 - Returning because "MaxBytes" bytes were read
     READRESULT_TIMEOUT = 3 - Returning because "TimeToWait" microseconds expired
     READRESULT_USERCANCEL = 4 - User cancelled
BytesRead - Returns actual number of bytes read into buffer
buffer - data buffer containing the bytes read - stored as VARIANT array
 

ReadString
[AsciiCE2]

Similar to Read() - but reads a string of text from the printer port. 

MFC Syntax: BSTR string=AsciiCE2a.ReadString(long MaxChars, long LastChar, long ModeFlags, 
                             long TimeToWait,long* ResultFlags,long*
CharsRead);
C++ Syntax: AsciiCE2a.ReadString(long MaxChars, long LastChar, long ModeFlags, long TimeToWait,
                             long* ResultFlags,long*
CharsRead ,BSTR string);
eVB Syntax: None (see ReadVar method). 

Parameters

MaxChars - Maximum number of characters to read.
LastChar - Optional - read data stream until this byte value is found, then return all data read.
ModeFlags - Defines following modes:
    READMODE_NORMAL = 0 - Reads all data into buffer
    READMODE_FLUSHZEROS = 1 - Ignores zero value bytes - all other data is read into buffer
TimeToWait - Maximum number of microseconds to wait for data from the printer. If 0, don't time out.

ResultFlags - Returns results of block read:
     READRESULT_ERR = 0 - Error trying to read (such as loss of infrared connection)
     READRESULT_OK = 1 - Read was successful
     READRESULT_FULLBUFFER = 2 - Returning because "MaxBytes" bytes were read
     READRESULT_TIMEOUT = 3 - Returning because "TimeToWait" microseconds expired
     READRESULT_USERCANCEL = 4 - User cancelled
CharsRead - Returns actual number of characters read into buffer
string - text containing the bytes read
 

ReadStringVar
[AsciiCE2]

Identical to ReadString() - except that the "ResultFlags" and "CharsRead" values are returned as VARIANTS. This is the preferred method for eVB to read text strings.

MFC Syntax: BSTR* string=AsciiCE2a.ReadStringVar(long MaxChars, long LastChar, 
                             long ModeFlags, long TimeToWait,VARIANT* ResultFlags,VARIANT*
CharsRead);
C++ Syntax: AsciiCE2a.ReadStringVar(long MaxChars, long LastChar, long ModeFlags, 
                             long TimeToWait,VARIANT* ResultFlags,VARIANT*
CharsRead, BSTR* string);
eVB Syntax: buffer = AsciiCE2a.ReadStringVar(MaxChars, LastChar, ModeFlags, TimeToWait,
                             ResultFlags,
CharsRead

Parameters

MaxChars - Maximum number of characters to read.
LastChar - Optional - read data stream until this byte value is found, then return all data read.
ModeFlags - Defines following modes:
    READMODE_NORMAL = 0 - Reads all data into buffer
    READMODE_FLUSHZEROS = 1 - Ignores zero value bytes - all other data is read into buffer
TimeToWait - Maximum number of microseconds to wait for data from the printer. If 0, don't time out.

ResultFlags - Returns results of block read:
     READRESULT_ERR = 0 - Error trying to read (such as loss of infrared connection)
     READRESULT_OK = 1 - Read was successful
     READRESULT_FULLBUFFER = 2 - Returning because "MaxBytes" bytes were read
     READRESULT_TIMEOUT = 3 - Returning because "TimeToWait" microseconds expired
     READRESULT_USERCANCEL = 4 - User cancelled
CharsRead - Returns actual number of characters read into buffer
string - text containing the bytes read
 

RepeatChar
[AsciiCE2 & AsciiCE]

This method sends one or more copies of a character byte value to the printer.

MFC Syntax:    AsciiCE2a.RepeatChar(long ch,long repeatcnt);

C++ Syntax:    AsciiCE2a.RepeatChar(long ch,long repeatcnt);

eVB Syntax: AsciiCE2a.RepeatChar ch, repeatcnt

Parameters

ch - character to be sent to printer
repeatcnt - count of number of copies of "ch" to send to printer.

SelectPort
[AsciiCE2 & AsciiCE]

This method selects the printer connection for an AsciiCE print job. It must precede any Acii printing operations. NOTE: See SelectPortEx() to allow reading data from printer port.

MFC Syntax:  long retval = AsciiCE2a.SelectPort(long Port,long BaudRate,long HandShake);

C++ Syntax:     AsciiCE2a.SelectPort(long Port,long BaudRate,long HandShake,long* retval);

eVB Syntax:  retval = AsciiCE2a.SelectPort(Port, BaudRate, Handshake)

Parameters

Port - Port type: 

Constant

Setting

Description

PORT_COM1

0

Open COM1

PORT_COM2

1

Open COM2

PORT_COM3

4

Open COM3

PORT_COM4

5

Open COM4

PORT_COM5

6

Open COM5

PORT_COM6

7

Open COM6

PORT_COM7

13

Open COM7

PORT_COM8

14

Open COM8

PORT_COM9

17

Open COM9

PORT_COM0

19

Open COM0

PORT_LPT

2

Open LPT1

PORT_IR

3

Open IR infrared port

PORT_TOFILE

8

Send all print data to \Output.prn file

PORT_SOCKETCOM

11

Socket PNC Bluetooth card support

PORT_COMPAQ

15

Compaq Bluetooth iPAQ or sleeve

PORT_IPAQ

15

Bluetooth iPAQ or sleeve

PORT_WIDCOMM 16 Device using WIDCOMM Bluetooth stack
PORT_BTQUIKPRINT 18 Special for WIDCOMM, HP iPAQ Bluetooth devices that pop up "Bluetooth Browser" to find/select BT printer at print time: using this flag bypasses the BT browser and uses most recent selected BT printer. To let user discover and select BT printer, use PORT_COMPAQ, PORT_IPAQ, PORT_WIDCOMM

PORT_PRINTERCE

-1

Share PrinterCE port with AsciiCE2. PrinterCE must already be connected to the printer by a successful call to PrinterCE's SelectPrinter() or SetupPrinter(). BaudRate and Handshake values are ignored and the PrinterCE values are used. See "Intermixing PrinterCE and AsciiCE2" for more info.

BaudRate

Constant

Setting

S_4800

0

S_9600

1

S_19200

2

S_38400

3

S_57600

4

S_115200

5

Handshake (plus OR any needed Handshake Bitflags below): 

Constant

Setting

Description

SOFTWARE_HANDSHAKE

0

Use Xon/Xoff

HARDWARE_HANDSHAKE

1

 

NO_HANDSHAKE

2

 

Handshake -> Parity: (OR with Handshake): 

Constant

Setting

Description

SET_PARITY_NONE

0x000

Default: No parity

SET_PARITY_EVEN 

0x0800

 

SET_PARITY_ODD

0x0400

 

Handshake -> Stopbits: (OR with Handshake): 

Constant

Setting

Description

SET_STOPBITS_ONE 

0x000

Default: No parity

SET_STOPBITS_ONEANDHALF 

0x0200

 

SET_STOPBITS_TWO 

0x0100

 

Handshake -> Bytesize: (OR with Handshake): 

Constant

Setting

Description

SET_BYTESIZE_8 

0x000

Default: 8 data bits per byte

SET_BYTESIZE_7 

0x0080

  7 data bits per byte

SelectPortEx
[AsciiCE2]

This method extends the SelectPort() method in two ways: it allows the creation of a "read" operation to permit reading data from the printer port. It also offers one additional "port type" - PORT_PRINTERCE - to allow shared use of the printer port by PrinterCE and AsciiCE2 -> with cautions and alerts sounded!! See AsciiCE discussion here.

MFC Syntax:
   long retval = AsciiCE2a.SelectPortEx(long Port,long BaudRate,long HandShake,long ReadBufferSize);  
C++ Syntax:
  
AsciiCE2a.SelectPortEx(long Port,long BaudRate,long HandShake,long ReadBufferSize,long* retval);
eVB Syntax:
  
retval = AsciiCE2a.SelectPortEx(Port, BaudRate, Handshake, ReadBufferSize)

Parameters

Port - Port type: 

Constant

Setting

Description

PORT_COM1

0

Open COM1

PORT_COM2

1

Open COM2

PORT_COM3

4

Open COM3

PORT_COM4

5

Open COM4

PORT_COM5

6

Open COM5

PORT_COM6

7

Open COM6

PORT_COM7

13

Open COM7

PORT_COM8

14

Open COM8

PORT_COM9

17

Open COM9

PORT_COM0

19

Open COM0

PORT_LPT

2

Open LPT1

PORT_IR

3

Open IR infrared port

PORT_TOFILE

8

Send all print data to \Output.prn file

PORT_SOCKETCOM

11

Socket PNC Bluetooth card support

PORT_COMPAQ

15

Compaq Bluetooth iPAQ or sleeve

PORT_IPAQ

15

Bluetooth iPAQ or sleeve

PORT_WIDCOMM 16 Device using WIDCOMM Bluetooth stack
PORT_BTQUIKPRINT 18 Special for WIDCOMM, HP iPAQ Bluetooth devices that pop up "Bluetooth Browser" to find/select BT printer at print time: using this flag bypasses the BT browser and uses most recent selected BT printer. To let user discover and select BT printer, use PORT_COMPAQ, PORT_IPAQ, PORT_WIDCOMM

PORT_PRINTERCE

-1

Share PrinterCE port with AsciiCE2. PrinterCE must already be connected to the printer by a successful call to PrinterCE's SelectPrinter() or SetupPrinter(). BaudRate and Handshake values are ignored and the PrinterCE values are used. See "Intermixing PrinterCE and AsciiCE2" for more info.

BaudRate : 

Constant

Setting

S_4800

0

S_9600

1

S_19200

2

S_38400

3

S_57600

4

S_115200

5

Handshake: 

Constant

Setting

Description

SOFTWARE_HANDSHAKE

0

Use Xon/Xoff

HARDWARE_HANDSHAKE

1

 

NO_HANDSHAKE

2

 

ReadBufferSize An integer value for number of bytes to be set aside for "read" buffer that AsciiCE2 will use to read and store data read in from the printer port. If ReadBufferSize is zero, then no read-buffer is established and no reading will occur. Otherwise, AsciiCE2 creates a separate read thread and buffer to store data read in from the printer port. See AsciiCE2's Read and Peek methods for more info.

SetErrorLevel
[AsciiCE2]

This Write-Only property sets error level of errors returned by AsciiCE2.

MFC Syntax:    AsciiCE2a.SetSetErrorLevel(long value);

C++ Syntax:     AsciiCE2a.put_SetErrorLevel(long value);

eVB Syntax:  AsciiCE2a.SetErrorLevel =value

Parameters

value - Integer that specifies four available error levels

Constant

Setting

Description

vbErrLevelNone

0 (default)

No errors are returned – Use StatusCheck to watch progress

vbErrLevelAll

1

All errors are returned

vbErrLevelTask

2

Only errors that force abort of current operation or of printer job are returned

vbErrLevelJob

3

Only errors forcing abort of the printer job are returned

Remarks

There are two approaches that a VB program can take while using AsciiCE2… first is to set up "On Error" statements in each sub or function that calls a PrinterCE method or property and use the "On Error" handler to determine the course of action when an error occurs within PrinterCE. The second approach is to use occasional calls to StatusCheck to determine if an error has occurred.

When an error occurs within AsciiCE2, the severity of the error is determined and PrinterCE "remembers" this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all calls to PrinterCE will remember that it is aborting and this will be handled gracefully.

This structure allows the VB program that uses AsciiCE2 to have a relaxed approach to error handling, even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck calls and display error dialog boxes as needed).

C++ and MFC-based applications can use the StatusCheck() method to determine if some error or user action has caused AsciiCE2 to stop printing. Since AsciiCE2 stops trying to print once an error or user cancel has been found, StatusCheck() only needs to be called when the application may be entering some extended period of activity.

SetReportLevel
[AsciiCE2]

This Write-Only property sets error level of errors returned by AsciiCE2..

MFC Syntax:    AsciiCE2a.SetSetReportLevel(long value);

C++ Syntax:    AsciiCE2a.put_SetReportLevel(long value);

eVB Syntax: AsciiCE2a.SetReportLevel =value

Parameters

value - Integer that specifies four available error levels

Constant

Setting

Description

vbReportErrors

0 (default)

All errors are reported to user by PrEngineCE via MsgBox() error reports 

vbNoReportErrors

1

No errors are reported by PrEngineCE... it is up to app to report errors.

Remarks

There are two approaches that a VB program can take while using AsciiCE2… first is to set up "On Error" statements in each sub or function that calls a PrinterCE method or property and use the "On Error" handler to determine the course of action when an error occurs within PrinterCE. The second approach is to use occasional calls to StatusCheck to determine if an error has occurred.

When an error occurs within AsciiCE2, the severity of the error is determined and PrinterCE "remembers" this as appropriate. So, for example, if a printer error occurs, the entire printing job must be aborted, so all calls to PrinterCE will remember that it is aborting and this will be handled gracefully.

This structure allows the VB program that uses AsciiCE2 to have a relaxed approach to error handling, even to the point of ignoring errors completely (although it would be kind to the user to do StatusCheck calls and display error dialog boxes as needed).

C++ and MFC-based applications can use the StatusCheck() method to determine if some error or user action has caused AsciiCE to stop printing. Since AsciiCE stops trying to print once an error or user cancel has been found, StatusCheck() only needs to be called when the application may be entering some extended period of activity.

StatusCheck
[AsciiCE2]

This READ-ONLY property returns the current status of AsciiCE2.

MFC Syntax:   long value=AsciiCE2a.GetStatusCheck();

C++ Syntax:    AsciiCE2a.get_StatusCheck(long * value);

eVB Syntax: value = AsciiCE2a.StatusCheck

Returns

value - Integer that specifies four possible status values

Constant

Setting

Description

vbNoError

0

No error to report

vbUserCancel

1

User cancelled print job

vbAbortOperation

2

Error aborted the last print operation (but the print job is still viable).

vbAbortPrint

3

Error aborted the print job

Text
[AsciiCE2 & AsciiCE]

This is the main text printing method.

MFC Syntax:    AsciiCE2a.Text(BSTR textstring);

C++ Syntax:    AsciiCE2a.Text(BSTR textstring);

eVB Syntax: AsciiCE2a.Text textstring

Parameters

textstring - Text string to be printed.  

Write
[AsciiCE2]

Sends block of data to printer..

MFC Syntax: AsciiCE2a.Write(BYTE* buffer,long NumberBytesToWrite,long* BytesWritten);

C++ Syntax: AsciiCE2a.Write(BYTE* buffer,long NumberBytesToWrite,long* BytesWritten);

eVB Syntax: None (see WriteVar method).

Parameters

buffer - Block of bytes to be sent to printer
NumberBytesToWrite - count of bytes to send from "buffer"
 
BytesWritten - Returns count of bytes successfully sent to printer  

NOTE: If using both PrinterCE and AsciiCE2 (SelectPortEx -> PORT_PRINTERCE mode) simultaneously, any calls to AsciiCE2's Write, WriteVar, or Text result in flushing all PrinterCE printing operations before processing the AsciiCE2 command. If the call to Write or WriteVar is strictly a printer control command, you can pass NumberBytesToWrite as a negative value (for example, NumberBytesToWrite = -22 if sending a 22 byte printer control block). A negative value for NumberBytesToWrite is passed immediately without causing PrinterCE operations to be printed first. See "Intermixing PrinterCE and AsciiCE2" for more info.

WriteVar
[AsciiCE2]

Sends block of data to printer. The data is passed in the form of a VARIANT array - this is eVB's native method of passing arrays of data and so WriteVar() should be used by eVB applications. 
For MFC and C++, the "Write" method is preferred.

MFC Syntax:
  
AsciiCE2a.WriteVar(VARIANT* buffer,long NumberBytesToWrite,long* BytesWritten);
C++ Syntax:
  
AsciiCE2a.WriteVar(VARIANT* buffer,long NumberBytesToWrite,long* BytesWritten);  
eVB Syntax:
  
AsciiCE2a.WriteVar varbuffer, NumberBytesToWrite, BytesWritten

Parameters

varbuffer - Block of bytes to be sent to printer - passed as VARIANT array.
NumberBytesToWrite - count of bytes to send from "buffer"
 (See NOTE for Write method above).
BytesWritten - Returns count of bytes successfully sent to printer