XbToolsIII Reference:xbt

Basics chapter Foundation

This chapter gives an overview about each function group and contains basic information about usage of functions of various function groups. It also provides some knowledge about the underlying mechanisms inherent to the operating system which may be required for a thorough understanding of the XbToolsIII functions. Differences between XbToolsIII and CA-Tools III are outlined as well.

Window function group

The text mode window system is comprised of the W...() function group the most important of which is the WInit() function. When you intend to use the text mode window system make sure to call WInit() once at startup of your program. Note that this is different to CA-Tools III. If you want to share the same code basis between DOS and OS/2 or Windows, respectively, you should enclose the WInit() call in a conditional compile structure:

 PROCEDURE Main 
    #ifdef __XPP__ 
       WInit() 
    #endif 

    <your code> 

The Xbase++ compiler implicitly defines the constant __XPP__ so this is the way to go if the same program code is to be compiled either with Xbase++ / XbToolsIII or with CA-Clipper / CA-Tools III.

In XbToolsIII the text mode window system is based on a VCrt Object. This object is a special output device for the VIO operating mode and manages a virtual screen (refer to the VCrt Class in the Xbase++ documentation). It follows a generic approach for windowing and is used in the reimplementation of the W..() functions known from CA-Tools III. However, VCrt objects are hidden from the programmer in that all text mode windows are accessed and identified by a numeric window handle (window ID). Thus, the basic programming pattern for using windows is given by the functions WOpen(), WSelect() and WClose():

nWin1 := WOpen( 6, 6, 15, 20, .T., "N/BG", 0 ) 
@ 0, 0 SAY "Hello World" 

nWin2 := WOpen( 10, 15, 22, 35, .T., "R/W", 2 ) 
@ 0, 0 SAY "Hi folks" 

WSelect( nWin1 ) 
@ 0, 0 SAY "First window selected again" 

WClose( nWin1 ) 
WClose( nWin2 ) 

The return value of WOpen() must be assigned to a variable in order to select a window and have consecutive screen output restricted to that window. When a window is selected all screen related functions use this particular window. This applies to functions like Row(), Col(), MaxRow() as well as SetCursor(), SetColor() or SaveScreen(). The screen coordinates start at the upper left corner of the window not at the upper left corner of the screen. The exception is when the root window is selected using WSelect(0). The numeric window ID 0 is reserved for the root window which represents the physical screen. If the root window is selected, all screen functions work like described in the Xbase++ documentation.

With respect to screen output there is a particular difference in the XbToolsIII window system compared to CA-Tools III. No screen output is possible at coordinates outside a window. This affects the display of a title in a framed window (a frame is drawn with WBox()). With CA-Tools III you could display a window title at the row coordinate -1. This is not possible with XbToolsIII. Here, the function WSetTitle() must be used for this particular purpose.

A major enhancement in XbToolsIII is that windows are "mouse aware". Function WMouseSelect(.T.|.F.) was added to determine whether or not windows can be detected and selected with a left mouse click. So you can program both, modal and modeless windows. Once mouse selection is activated (-> WMouseSelect(.T.)) function AppEvent() returns the event code xbeXT_WSelect plus the window IDs of the new and the current window in its first and second message parameters. The default behavior is that the clicked window gets selected. However, you can specify a codeblock with SetAppEvent( xbeXT_WSelect ) that implements a different behavior (refer to the NONMODAL.PRG sample program).

Default event handling in windows
Event Action
Left button down Selects the clicked window
Clicking a window frame starts mouse move mode
Left button up Terminates mouse move mode
Alt+F7 Starts keyboard move mode
Cursor keys Window is moved with the Up, Left, Down and Right keys
if keyboard move mode is enabled
Esc Aborts keyboard move mode, window position
remains unchanged
Return Terminates keyboard move mode, window position changes

Windows can be moved either with the mouse by clicking on the window frame or with the keyboard using the cursor keys. To enter the window move mode for the keyboard CA-Tools III uses the Scroll-lock key. This is not the case in XbToolsIII. Here, the key combination Alt+F7 is used to start moving windows around with the cursor keys.

Window Functions
Function Description
GetWBoard() Retrieves the current WBoard() setting in an array.
WaClose() Closes all windows.
WBoard() Determines the area on the screen (text mode) that can be used for windows.
WBox() Draws a frame around the active window
WCenter() Makes a window entirely visible on the screen or centers it.
WClose() Closes the active window and selects the next window to be active.
WCol() Returns the left column position of the active window.
WColor() Sets or retrieves the color setting for the current window.
WfCol() Returns the left column position of the formatted area in a window.
WfLastCol() Returns the right column position of the formatted area in a window.
WfLastRow() Returns the bottom row position of the formatted area in a window.
WFormat() Defines the output area inside the active window.
WfRow() Returns the top row position of the formatted area in a window.
WGetClearB() Retrieves the default character attribute for clearing windows.
WInit() Initializes the text mode window system
WLastCol() Returns the right column position of the active window.
WLastRow() Returns the bottom row position of the active window.
WMode() Determines on which side windows may be moved outside the screen.
WMouseSelect() Sets or retrieves whether a window can be selected with a left mouse click.
WMove() Sets new coordinates for the upper left corner of the active window.
WNum() Returns the largest window id (the window in front).
WOpen() Opens a new window.
WRestScreen() Restscreen() for a specified window.
WRow() Returns the top row position of the active window.
WSaveScreen() SaveScreen() for a specified window.
WSay() Displays a string at specified row/column coordinates in a window.
WSelect() Selects an open window as the active one.
WSetClearB() Sets a new clear attribute for windows.
WSetColor() Sets or retrieves the color setting for the active window and the system.
WSetCursor() Sets or retrieves the cursor shape of the active window.
WSetMove() Toggles whether a window may be moved interactively.
WSetShadow() Defines the shadow color for windows opened after WSetShadow()
WSetTitle() Displays a title in the box surrounding a window.
WStep() Sets the increments for horizontal and vertical window movement.

Extended Text Mode functions group

All functions of this group cannot be used in XbpDialog windows. If you use extended text mode functions and want your application to run in GUI mode, your application window must be an XbpCrt window.

Several CA-Tools III functions directly access the hardware via interrupts or BIOS and are not supported in XbToolsIII. This applies to keyboard input and print output which is managed by device drivers under 32-bit operating systems. Different video modes, like EGA 43 lines or VGA 50 lines, are emulated using a VCrt object. The same is true for video pages used for fast screen output under DOS. When your program calls functions like GetPage() oder SetPage() it actually switches between VCrt objects, not between video pages of your graphics adapter. So there is no considerable gain in performance over normal screen output when using screen pages.

Extended Text Mode
Function Description
Cga40() Switches the screen to 40 character CGA mode (color or monochrome).
Cga80() Switches the screen to 80 character CGA mode (color or monochrome)
DSetType() Retrieves the size of the Xbase++ event queue (SET TYPEAHEAD).
Ega43() Switches the screen to 43 line EGA mode.
GetBoxGrow() Retrieves the delay interval used for opening boxes.
GetCursor() Retrieves the shape of the cursor.
GetKxlat() Retrieves a current key translation.
GetKxtab() Retrieves the entire keyboard translation table.
GetLines() Retrieves the number of lines after which the LIST command will wait.
GetMode() Retrieves the current screen mode as a function name.
GetPage() Retrieves the number of the current screen page.
GetPxlat() Retrieves the entire printer translation table.
GetScrMode() Retrieves the current video mode.
GetTab() Retrieves the current tab settings for screen output.
InkeyTrap() Inkey() equivalent which evaluates SetKey() code blocks.
InputMode() Determines active or last input mode.
KeyRead() Retrieves the key codes that have been read from the event queue already.
KeySend() Writes keycodes into the event queue.
MaxCol() Returns MaxCol() of the current or the root window.
MaxPage() Retrieves the maximum number of screen pages.
MaxRow() Returns MaxRow() of the current or the root window.
Monochrome() Switches the screen to monochrome mode.
PageCopy() Copies a screen page into another one.
PrintError() Retrieves error code for the last printout.
SetBell() Sets frequency and duration for default warning tone - Chr(7)
SetBoxGrow() Sets delay interval for WBox().
SetCursor() Retrieves or sets the cursor shape
SetKxlat() Redefines or disables single keys.
SetKxtab() Installs a keyboard translation table that was saved with GetKxtab().
SetLines() Sets the number of output lines after which the LIST command will wait.
SetPage() Selects a screen page.
SetPxlat() Defines a character translation for printer output.
SetScrMode() Sets a new video mode.
SetTab() Sets the tab width for screen output.
Vga28() Switches the screen to 28 line VGA mode.
Vga50() Switches the screen to 50 line VGA mode.

Serial Port group

A serial port (COM port) is the only means for bidirectional exchange of data between two workstations. Functions in the Serial Port group allow access to COM ports for serial communication or manipulation of devices connected to a COM port. The most important functions used to establish a serial communication are Com_Open() (opens a COM port), Com_Init() (sets transmission parameters), Com_Read() (reads data from the input buffer), Com_Send() (writes data to the output buffer) and Com_Close() (closes a COM port). These functions cover the basic requirements for a program to send and receive data via a COM port. A subset of functions is provided for the specific requirements of data exchange via modem. This includes detection of signals like Data Carrier Detect (DCD) or Ready To Send (RTS) as well as functions to ensure correct transmission of data like building a block for the X-Modem protocol or calculating a Cyclic Redundancy Checksum (CRC).

Programmers coming from DOS must be aware of the fact that modern operating systems handle COM ports differently than DOS. Therefore the behavior of the XbToolsIII functions may slightly differ from the behavior of their DOS (CA-Tools III) complements. CA-Tools III functions directly manipulate the hardware while XbToolsIII functions communicate with a device driver. This makes the XbToolsIII functions dependent on the capabilities of the device driver installed. The information about the most important signals like RTS, CTS, DSR, DTR, DCD and RI is correct no matter what driver is installed. However, existing DOS applications that rely on the contents of hardware registers like LSR, MSR or MCR might have a problem if they are ported to a 32-bit operating system because the return values of functions Com_SMode(), Com_LSR(), Com_MSR() and Com_MCR() can differ. Also, all CA-Tools III functions which directly access the hardware are obsolete under 32-bit operating systems and are not supported in XbToolsIII.

It is important to initialize the COM ports with the same communication parameters like baud rate, data bits, stop bits etc. and the baud rate not set too high. It is a good practice to use a communication protocol for data exchange, like the X-Modem protocol, so the receiving workstation can detect when transmission starts, when it ends, how many data is transmitted and it should acknowledge reception of data to the sending workstation. This is especially important when your program uses a separate thread to monitor a COM port for incoming data in the background. On the receiving workstation you have no control about the time when data arrives and you will not know whether data is waiting unless you read the receive buffer with Com_Read(). All characters read are deleted from the receive buffer. It is not possible to read the same data twice so you should always assign the return value of Com_Read() to a variable for further processing.

Windows note: it is possible under Windows to detect incoming data without retrieving them from the receive buffer. Function Com_Event() is used for this purpose which is not available under OS/2.

OS/2 note: If you encounter problems under OS/2 when establishing a serial communication between two workstations make sure to have the device drivers properly installed (we can recommend Ray Gwinn's SIO/VSIO drivers for OS/2).

When your application program expects to receive data from another workstation or from a device connected to a COM port you probably want to have a thread running to wait for incoming data while your application performs some other tasks. This is by far the most comfortable way to receive data which you don't know when they will arrive. The background thread looks every other second whether data arrived and 'sleeps' in between. Once it receives data it continues to call Com_Read() until the sender signals End of Transmission. The only problems to solve in this scenario is how to get the received data into the main thread and how to stop the background thread if this is required. The following code fragment shows a solution:

#define S_ACK   Chr(6)             // Acknowledge 
#define S_EOT   Chr(4)             // End of transmission 

PROCEDURE Main                     // Main thread 
   LOCAL aInput, aQueue, oThread, i, imax 

   PUBLIC lStopThread := .F.       // Global trigger for thread 

   aQueue  := {}                   // Array to store received data 
   oThread := Thread():new() 
   oThread:setPriority( PRIORITY_ABOVENORMAL ) 
   oThread:start( "ReceiveData", aQueue ) 

   DO WHILE <condition>            // Execute foreground tasks 
      <code for main application thread> 

      IF ! Empty( aQueue )         // Thread received data 
         lStopThread := .T.        // Tell thread to stop 
         oThread:synchronize( 0 )  // Wait until thread stops 
         aInput := aQueue          // Assign array reference 
         aQueue := {}              // Create new array reference 
         lStopThread := .F.        // Continue to receive data 
         oThread:start( "ReceiveData", aQueue ) 

         imax := Len( aInput )     // Process received data 
         FOR i:=1 TO imax          // main thread 
            <do something with aInput[i]> 
         NEXT 
      ENDIF 
   ENDDO 
RETURN 


PROCEDURE ReceiveData( aQueue )    // Procedure runs parallel 
   LOCAL cData, cBuffer := ""      // to the main thread 

   DO WHILE .NOT. lStopThread      // PUBLIC variable triggers loop 
      cData := Com_Read( 2, 1 )    // Read one byte from COM port 2 
      IF cData == S_ACK            // Transmission starts 
         DO WHILE ! (cData := Com_Read( 2, 1 )) == S_EOT 
            cBuffer += cData       // Read until End of Transmission 
         ENDDO 
         AAdd( aQueue, cBuffer )   // Add to array of main thread 
         cBuffer := ""             // Clear buffer 
      ELSE 
         Sleep( 50 )               // No transmission, sleep 1/2 second 
      ENDIF 
   ENDDO 

RETURN 

This code is a rough outline to demonstrate the basic program logic of a background thread used to monitor a COM port for incoming data. A PUBLIC variable, which is visible in both threads, is used to trigger the execution of the thread that runs the procedure ReceiveData(). A LOCAL array aQueueis passed via the Thread:start() method to this procedure. It runs parallel to the main thread and the array is used like a queue to collect incoming data. Once the main thread has time to process received data it stops the background thread by setting the PUBLIC variable to .T. and waits until the background thread finishes. The array aQueue is then assigned to another LOCAL variable of the main thread. After aQueue is initialized again with an empty array the background thread continues to receive data while the main thread processes received data.

One prerequisite for this program to work is a transfer protocol that signals at least the start and the end of transmission. Refer to the ..\SAMPLES\COMLINK sample programs for a more sophisticated transfer protocol.

Serial Port Functions
Function Description
Com_Break() Sets a BREAK state on the send line for a specified period of time.
Com_Close() Closes the receive queue of a COM port.
Com_Count() Returns the number of bytes in the receive queue.
Com_CRC() Performs a Cyclic Redundancy Check for strings.
Com_CTS() Returns Clear To Send status.
Com_DCD() Returns Data Carrier Detect state.
Com_DSR() Returns Data Set Ready state.
Com_DTR() Sets or retrieves the Data Terminal Ready state.
Com_ErrChr() Defines character for error replacement.
Com_Event() *) Waits for an event or a character to arrive at a COM port
Com_Flush() Flush receive queue of a COM port.
Com_Hard() Toggles automatic hardware handshake.
Com_Init() Initializes a COM port
Com_LSR() Reads the Line Status Register.
Com_MCR() Sets or retrieves the Modem Control Register.
Com_MSR() Reads the Modem Status Register.
Com_Num() Available number of RS-232 devices.
Com_Open() Opens a COM port.
Com_Read() Reads characters from the specified COM port.
Com_ReadMode() Controls the Read Timeout processing characteristics of the device driver.
Com_Ring() Retrieves modem Ring Indicator.
Com_RTS() Sets or retrieves Request To Send status.
Com_SCount() Retrieves the number of bytes stored in the transmit buffer.
Com_Send() Writes data to the specified COM port
Com_SendMode() Controls Write Timeout characteristics of the physical device driver.
Com_SFlush() Flushes the transmit queue of a specific COM port.
Com_SMode() Retrieves current state of sending (transmit status).
Com_Soft() Toggles automatic software handshake (XON/XOFF).
Com_Soft_R() Checks whether an XOFF signal was received.
Com_Soft_S() Checks whether transmitter is about to send an XON signal.
XMoBlock() Builds a block for the XModem protocol.
XMoCheck() Checks whether the received block is a valid XModem block.
ZeroInsert() Encodes a string according to CCITT specifications.
ZeroRemove() Decodes a CCITT encoded string.
  1. only under Windows available

String Functions group

The String Functions group contains an extensive number of functions for various and complex string operations. This includes formatting of strings for screen output, search and replace operations as well as string conversion routines. Most of the functions work with strings on the base of characters just like the Xbase++ functions At() or Stuff().

A special subset of functions treat strings on binary basis and allow logical operations to be performed with strings, like CharAND() or CharXOR(). For example, assume two variables cChrA := "A" and cChrZ := "Z". Then logical operations with both variables would result this:

                cChrA   = A  Decimal =  65   Binary = 01000001 
                cChrZ   = Z  Decimal =  90   Binary = 01011010 

CharAND( cChrA, cChrZ ) = @  Decimal =  64   Binary = 01000000 
CharOR ( cChrA, cChrZ ) = [  Decimal =  91   Binary = 01011011 

It is obvious that logical operations are actually performed on the bits set in the numeric ASCII code of a character.

Searching strings and string comparison using wild card characters is possible with Like(), CSetAtLike() and the At...() functions. Together with the SET LEXICAL ON|OFF switch of Xbase++ you have enhanced flexibility for "not exact but close to" search routines with strings.

For the analysis of strings an incremental tokenizer is available that is especially useful for large strings. A string is first passed to TokenInit() and then tokenized using the TokenNext() function. Nested calls to the tokenizer are possible using SaveToken() and RestToken() to save and restore the tokenizer environment. (Refer to the ..\SAMPLES\TOKEN directory for comprehensive examples of the tokenizer).

String Functions
Function Description
AddASCII() Adds a numeric value to the ASCII code of a specified character in a string.
AfterAtNum() Substring right to the last occurrance of a search string found in a string.
ASCIISum() Sums the ASCII codes of all characters in a string.
AscPos() Determines the ASCII code of a specified character in a string.
AtAdjust() Justifies a substring within a string.
AtNum() Determines the position of a substring within a string (multiple occurrances)
AtRepl() Searches a substring within a string and replaces it with another substring
AtToken() Determines the position of the n-th token in a string.
BeforAtNum() Substring left to the last occurrance of a search string found in a string.
Center() Centers a string.
CharAdd() Adds the ASCII codes of corresponding characters in two strings.
CharAND() Binary ANDs the ASCII codes of corresponding characters in two strings.
CharEven() Retrieves all characters at even positions in a string.
CharList() Removes duplicate characters from a string.
CharMirr() Reverses the order of characters in a string.
CharMix() Mixes characters of two strings.
CharNoList() Creates a string containing missing characters.
CharNOT() Binary complements the ASCII codes of all characters in a string.
CharOdd() Retrieves all characters at odd positions in a string.
CharOne() Removes the specified duplicate characters from a string.
CharOnly() Removes all but the specified characters from a string
CharOR() Binary ORs the ASCII codes of corresponding characters in two strings.
CharPack() Packs a string.
CharRela() Determines whether two substrings in two strings have the same position.
CharRelRep() Replaces characters if 2 substrings are found in 2 strings at the same position.
CharRem() Removes specified characters from a string.
CharRepl() Defines characters to replace specified characters in a string.
CharSort() Sorts characters or substrings within a string.
CharSpread() Formats a string for block paragraphs.
CharSwap() Exchanges adjacent characters in a string.
CharUnpack() Unpacks a string which was packed with CharPack().
CharXOR() Binary XORs the ASCII codes of corresponding characters in two strings.
CheckSum() Calculates a checksum for strings.
CountLeft() Counts a specified character at the beginning of a string.
CountRight() Counts a specified character at the end of a string.
Crypt() Encrypts/Decrypts a string.
CSetAtMuPa() Sets Multiple Pass mode for At???() functions.
CSetRef() Sets or retrieves the Pass by Reference setting for string functions.
Expand() Inserts a character between adjacent characters in a string.
JustLeft() Moves characters from the beginning to the end of a string.
JustRight() Moves characters from the end to the beginning of a string.
Like() Compares strings allowing *? wild cards.
LtoC() Changes a logical value to a character.
MaxLine() Determines the longest line in a (formatted) string.
NumAt() Counts a substring in a string.
NumLine() Determines the number of lines needed to output a string.
NumToken() Counts tokens in a string.
PadLeft() Fills a string on the left side.
PadRight() Fills a string on the right side.
PosAlpha() Retrieves the position of the first letter in a string.
PosChar() Replaces a single character at a specified position in a string.
PosDel() Removes characters at a specified position in a string.
PosDiff() Determines the first position where two strings are different.
PosEqual() Determines the first position where two strings are equal.
PosIns() Inserts a single character at a specified position in a string.
PosLower() Retrieves the position of the first lower case letter in a string.
PosRange() Retrieves the position of the first character out of a range found in a string.
PosRepl() Replaces characters in a string at a specified position.
PosUpper() Retrieves the position of the first upper case letter in a string.
RangeRem() Deletes all characters in a string out of a range of specified characters.
RangeRepl() Replaces a range of characters with a specified character.
RemAll() Removes a specified character from the left and the right side of a string.
RemLeft() Removes a specified character from the left side of a string.
RemRight() Removes a specified character from the right side of a string.
ReplAll() Replaces specified characters at the left and the right side of a string.
ReplLeft() Replaces specified characters at the left side of a string.
ReplRight() Replaces specified characters at the right side of a string.
RestToken() Restores the environment of the incremental tokenizer.
SaveToken() Saves the environment of the tokenizer.
SetAtLike() Sets the search mode for At???() functions
StrDiff() Calculates the similarity of two strings (Levenshtein distance)
StrSwap() Exchanges characters between two strings.
TabExpand() Replaces a tab with a specified number of another character.
TabPack() Replaces multiple occurrances of a character with a tab (= Chr(9)).
Token() Retrieves the n-th token from a string.
TokenAt() Retrieves the position of the token found with TokenNext().
TokenEnd() Checks whether tokens still can be found with TokenNext().
TokenInit() Prepares a string for the incremental tokenizer.
TokenLower() Changes the first character of tokens to lower case.
TokenNext() Retrieves the next token from a string.
TokenSep() Retrieves the delimiter of a token.
TokenUpper() Changes the first character of tokens to upper case.
ValPos() Retrieves the numeric value of a character at a specified position in a string.
WordOne() Removes multiple words (2 byte sequences) in a string.
WordOnly() Removes all words (2 byte sequence) from a string not defined in a word list.
WordRepl() Replaces words (2 byte sequences) in a string with a specified word.
WordSwap() Swaps adjacent words (2 byte sequences) in a string.
WordToChar() Replaces words (2 byte sequence) with characters (1 byte)

Numbers and Bits group

Most of the functions of the Numbers and Bits group are useful for numeric conversions or allow bitwise operations on binary strings. It is possible to directly manipulate single bits of a binary string or to convert bits set in an integer to a string containing a series of "1" and "0".

Special purpose functions are included in this group which solve some common programming problems, like creating random numbers or maintaining counters.

Numbers and Bits
Function Description
BitToC() Converts bits set in an integer to characters.
Celsius() Converts degrees Fahrenheit to Celsius.
ClearBit() Sets one or more bits of a number to 0.
CtoBit() Converts a string to an integer
CtoF() Converts an 8 byte string to a floating point number
CtoN() Converts a string to an integer of the specified base.
Exponent() Calculates the exponent of a floating point number (base 2).
Fahrenheit() Converts degrees Celsius to Fahrenheit.
FtoC() Converts a floating point number to an 8 byte string.
Infinity() Returns the largest possible number (2**1023)
IntNeg() Converts an unsigned integer to a signed integer.
IntPos() Converts a signed integer to an unsigned integer.
IsBit() Checks whether a bit is set at a specified position.
LtoN() Converts a logic to a numeric value.
Mantissa() Calculates the mantissa of a floating point number (base 2).
NtoC() Converts an integer to a string of digits for a specified base.
NumAND() Bitwise AND for a list of 16 bit integers.
NumCount() Increments or sets the start value of the internal counter.
NumHigh() Retrieves the high byte of a 16 bit integer.
NumLow() Retrieves the low byte of a 16 bit integer.
NumMirr() Mirrors 8 or 16 bits of a 16 bit integer.
NumNOT() Bitwise NOT of a 16 bit integer.
NumOR() Bitwise OR for a list of 16 bit integers.
NumRoL() Left rotation of a 16 bit integer.
NumXOR() Bitwise XOR of two 16 bit integers.
Rand() Calculates random numbers between 0 and 1.
Random() Calculates random numbers as 16 bit integers.
SetBit() Sets one or more bits of an integer to 1.

Video Functions group

All tasks of the Video Functions group are related to video modes and text mode screen output as known under DOS. Therefore they are all restricted to full screen sessions or XbtCrt windows and cannot be used in a XbpDialog window. The subset of functions dealing with fonts is even more restricted to applications running in full screen sessions. These functions manipulate hardware fonts which is not possible when a program runs in a XbpCrt window.

The display of a single character on the screen requires two bytes, the character itself and a color attribute. Usually a string containing color attributes is created with the SaveScreen() function. Characters visible on screen are found at odd positions in a screen string and color attributes at even positions. Thus, the two string functions CharOdd() and CharEven() are useful to extract text and color information from a screen string. The function ScreenMix() can then be used to mix text and color attributes and "assemble" a screen string ready for display using RestScreen().

Direct manipulation of color attributes is possible as well as manipulation of displayed characters. This allows you, for instance, to color mark words in MemoEdit() or to change characters on the screen without changing the colors. This kind of screen output neither changes the cursor position nor does it affect the SetColor() setting.

Video Functions
Function Description
CharPix() Determines the number of pixel rows used to display characters.
CharWin() Replaces characters on the screen.
ClearEol() Clears a row on the screen beginning at a specified position.
ClearSlow() Clears the screen with delay (imploding effect).
ClearWin() Clears (part of) the screen.
ClEol() Clears a row on the screen in black beginning at a specified position.
ClWin() Clears (part of) the screen in black.
ColorRepl() Replaces color attributes.
ColorToN() Converts a color string to a numeric color attribute.
ColorWin() Replaces a color attribute in a specified area on the screen.
Enhanced() Selects the enhanced color (2nd color) of SetColor().
FileScreen() Reads the contents of a screen from a file.
FontLoad() Loads EGA or VGA fonts from a file.
FontReset() Discards all loaded fonts and resets the font to system default.
FontRotate() Mirrors or rotates characters of a font.
GetClearA() Retrieves the default color attribute for clearing the screen.
GetClearB() Retrieves the default character attribute for clearing the screen.
GetFont() Copies the current font into a string.
GetScrStr() Retrieves the screen string for hidden screen output.
InvertAttr() Inverts the foreground and the background color of a color attribute.
InvertWin() Inverts the foreground and the background color on the screen.
IsCga() Checks whether a CGA graphics card can be emulated.
IsEGA() Checks whether an EGA graphics card can be emulated.
IsHercules() Checks whether a Hercules graphics card can be emulated.
IsMCGA() Checks whether a MCGA graphics card can be emulated.
IsMono() Checks whether a Monochrome graphics card can be emulated.
IsPGA() Checks whether a PGA graphics card exists be emulated.
IsVGA() Checks whether a VGA graphics card is installed.
MaxFont() Determines the maximum number of font areas.
NtoColor() Converts a numeric color attribute to a string.
NumCol() Retrieves the maximum number of useable screen columns
NumColors() Determines the number of available colors
RestCursor() Restores position and shape of the screen cursor.
SaveCursor() Saves the current cursor position and shape.
SayDown() Outputs a string vertically downwards.
SayMoveIn() Outputs a string on the screen using a "move in" effect.
SayScreen() Displays a string on screen without changing existing color attributes.
SaySpread() Outputs a string on the screen using a "spread" effect.
ScreenAttr() Determines the color attribute at a specified position on the screen.
ScreenFile() Writes the current contents of the screen to a file.
ScreenMark() Searches strings on the screen and marks them with a color attribute.
ScreenMix() Mixes a string of characters with a string of color attributes
ScreenSize() Retrieves the size of the available screen
ScreenStr() Retrieves the screen contents beginning at a specified position.
SetClearA() Sets the default color attribute for clearing the screen.
SetClearB() Sets the default character attribute for clearing the screen.
SetFont() Activates a font that was saved to a string.
SetRC() Sets the current cursor position and updates Row() and Col().
SetScrStr() Toggles hidden screen output.
Standard() Selects the standard color (1st color) of SetColor().
StrScreen() Displays a screen string at the specified position.
UnSelected() Selects the unselected color (5th color) of SetColor().
UntextWin() Replaces all characters on the screen except a range of characters.
VideoInit() Resets the video mode.
VideoSetup() Queries the video mode at program startup.
VideoType() Retrieves information about video adapters.

Disks and Drives group

Functions for Disks and Drives are useful when you need to get information about available drives (hard disk or floppy drives), directories and files. You can easily determine whether a floppy drive is ready for write access or if there is enough storage space left. Functions in this group handle runtime errors created by the operating system when a drive is not ready or if a directory does not exist.

The comfortable FileSeek() function allows you to process a group of files matching a given file mask and/or file attributes. The initial call to FileSeek() creates an internal buffer with information of all files matching the search conditions and returns the first file name found. Consecutive calls to the function return the next file name until the last one is reached. The functions SaveFSeek() and RestFSeek() are used for nested calls to save and restore the FileSeek() environment. This allows you to recurse through subdirectories and process an entire directory tree.

A special FileCopy() function is available to perform a fragmented copying of files to several disks. If a file is too large to fit on a single disk FileCopy() can be used in backup mode. It stops copying when the disk is full. The user can then be asked to change the disk and the program can continue copying by calling the FileCCont() function.

Disks and Drives
Function Description
DeleteFile() Deletes a file and handles OS errors.
DirChange() Changes the current directory.
DirMake() Creates a subdirectory.
DirName() Retrieves the current directory on the specified drive.
DirRemove() Deletes a directory.
DiskChange() Changes the current drive.
DiskCheck() Calculates a checksum for disks.
DiskFree() Determines the free storage capacity of a specified drive in bytes.
DiskName() Determines the current drive.
DiskReady() Checks whether a drive is ready.
DiskReadyW() Checks whether a drive can be written to.
DiskTotal() Determines the total storage capacity of a disk in bytes.
DiskType() Determines the type of a disk or diskette.
DriveType() Determines the type of a drive.
FileAppend() Concatenates two files.
FileAttr() Determines file attributes of one or more files.
FileCClose() Closes the file opened in backup mode with FileCopy().
FileCCont() Continues file copying in backup mode of FileCopy().
FileCDaTi() Toggles between file date/time and system date/time for FileCopy().
FileCheck() Calculates a checksum for a file.
FileCOpen() Checks whether the file opened in backup mode with FileCopy() is still open.
FileCopy() Copies files normally or in backup mode.
FileDate() Retrieves the date of a file.
FileDelete() Deletes one or more files specified by a file mask and file attributes.
FileMove() Moves a file to another directory.
FileSeek() Seeks files specified by a file mask and file attribute
FileSize() Determines the size of a file.
FileStr() Reads a string from a file starting at a specified position.
FileTime() Retrieves the time of a file.
FileValid() Checks whether a string contains a valid filename
FloppyType() Determines the type of a floppy drive.
GetShare() Retrieves the sharing mode set with SetShare().
NumDiskF() Retrieves the number of floppy drives.
NumDiskH() Retrieves the number of harddisk drives.
NumDiskL() Retrieves the number of logical drives.
RenameFile() Renames a file and handles errors.
RestFseek() Restores a FileSeek() environment.
SaveFseek() Saves the current FileSeek() environment to a string.
SetFattr() Sets file attributes.
SetFcreate() Sets the default file attribute(s) for creating files.
SetFDaTi() Sets date and time of a file.
SetShare() Sets the default sharing mode for files.
StrFile() Writes a string to a file starting at a specified position.
TempFile() Creates a temporary file with a unique filename.
TrueName() Completes a path specification to include the root directory.
VolSerial() Retrieves the serial number of a disk(ette).
Volume() Sets the volume label of a disk(ette)

Printer Functions group

Functions in this group are used for spooler management and sending data to a printer. Before calling a printer function be sure to have a printer object properly installed and configured on your desktop (refer to your user manual for printer configuration). Without a correct configured printer object the XbToolsIII printer functions are not guaranteed to perform their tasks correctly.

Unlike DOS, a modern operating system utilizes a spooler by default for sending data to a printer. This has the advantage that an application does not need to wait until a print job is finished. Once a print job is created by an application the spooler takes responsibility for the printout and the application program can continue with other tasks. Although this is comfortable for a programmer it can lead to confusion when testing the readiness of a printer with the PrintReady() function. When a spooler is active this function returns .T. (true) even if the physical printer is not ready. The spooler then signals its readiness to receive data for a printer from the application program. In this case it is the spooler's resposibility to check the readiness of the physical printer and it prompts an error message if the printer is not ready. This again is extremely advantageous for programmers because they do not need to implement code for standard printer errors.

With its PRINT utility program DOS supports only one spool queue and so do the CA-Tools III printer functions. Since 32-bit operating systems can handle more queues at a time all XbToolsIII printer functions have an additional parameter to specify the printer used to print. Unlike the CA-Tools III function SpoolEntry() the XbTools implementation does not stop the spooler and function SpoolActiv() does not resume a paused print job. To control the spooler a new function SpoolControl() exists. It allows you to:

- delete a print job from the queue

- pause the print device

- continue a paused print job

- restart a print job

Functions SpoolAdd() and SpoolControl() give you maximum flexibility for directing print jobs to a particular printer and let you take full advantage of the comfortable spool device. Although Print..() functions exist in XbToolsIII to send data to a printer they write them to a spooler if one is active. So the function call PrintSend(MemoRead(<fileName>)) actually behaves like a SpoolAdd(<fileName>) except that SpoolAdd() sets the correct print job title.

Printer Functions
Function Description
NumPrinter() Retrieves the number of parallel ports (printer ports).
PrintFile() Prints an ASCII file and optionally deletes high-bit (MSB).
PrintInit() Initializes a printer.
PrintReady() Checks whether a printer connected to the specified port is ready.
PrintScr() Prints the contents of the screen.
PrintSend() Sends a string or a single character to the printer.
PrintStat() Determines the status of a parallel port.
SpoolActiv() Checks whether a spooler is active for a specified port.
SpoolAdd() Adds the contents of a file to the spooler queue.
SpoolControl() Controls a spooler.
SpoolCount() Determines the number of print jobs.
SpoolDel() Deletes a specified print job from the queue.
SpoolEntry() Retrieves a document name (filename) of a specified job in the print queue
SpoolFlush() Deletes all print jobs from the queue.

Date and Time Functions group

Functions of the Date and Time group deal with seconds, days, months, quarters and years. You can determine the first or last day of a given quarter of a year or calculate a day's number from its date. All these functions are useful in solving common accounting problems or for analysis of time based statistics.

Date and Time Functions
Function Description
AddMonth() Adds a number of months to a date value.
BoM() Determines the date of the first day in a month.
BoQ() Determines the date for the begin of a quarter.
BoY() Determines the date for the begin of a year.
CtoDoW() Converts a week day to its corresponding number.
CtoMonth() Converts a month name to its corresponding number.
DMY() Creates a date string in the format "dd. Month yy"
DoY() Calculates the number of a day in a year.
EoM() Determines the date of the last day in a month.
EoQ() Determines the date of the last day in a quarter.
EoY() Determines the date for the end of a year.
IsLeap() Checks whether a year is a leap year.
LastDayoM() Determines the number of days in a month.
MDY() Creates a date string in the format "Month dd, yy"
NtoCDoW() Converts a numeric week day to a string (1 = Sunday)
NtoCMonth() Converts a numeric month to a string (1 = January).
Quarter() Determines the quarter a date belongs to.
SecToTime() Converts seconds to a time string.
SetDate() Sets the system date.
SetTime() Sets the system time.
ShowTime() Displays the system time continuously at the specified position on screen.
StoD() StoD() is part of the Xbase++ runtime DLL.
TimeToSec() Converts a time string to the number of seconds elapsed since midnight.
TimeValid() Validates a time string.
WaitPeriod() Allows time controlled loops.
Week() Calculates the calendar week from a date.
WoM() Calculates the week number in a month.

Database Functions group

Functions in this group merely exist for compatibility reasons, so existing CA-Clipper code can be compiled without a problem. The database and field information returned by these functions can be easily retrieved with the DbInfo() and FieldInfo() functions of Xbase++.

Database Functions
Function Description
DbfDskSize() Determines the size of a DBF file on disk that is opened in a workarea.
DbfSize() Determines the size of a DBF file in memory that is opened in a workarea.
FieldDeci() Determines the number of decimal places of a database field.
FieldNum() Determines the ordinal position of a field in a database.
FieldSize() Determines the length of a database field.
FieldType() Determines the type of a database field.
IsDbt() Determines whether a memo field exists in a database file.

Settings and Status group

Most of the Settings and Status functions are functional equivalents of SET commands used to define system settings. This allows settings to be queried or set from within a codeblock and is an alternative to the Set() function in conjunction with a #define constant from SET.CH.

Settings and Status
Function Description
Cset????() Sets or retrieves any ON | OFF setting
CsetAll() Sets or retrieves all ON | OFF settings.
CsetDate() Determines the current date format.
CsetDeci() Retrieves the current setting of SET DECIMALS TO.
CsetDefa() Retrieves the current setting of SET DEFAULT TO.
CsetKey() Retrieves the current setting of SET KEY TO.
CsetLDel() Retrieves the left delimiter of SET DELIMITERS TO
CsetMarg() Retrieves the current setting of SET MARGIN TO.
CsetPath() Retrieves the current setting of SET PATH TO.
CsetRDel() Retrieves the right delimiter of SET DELIMITERS TO.
CsetRdOnly() Sets or retrieves the current setting of the READONLY option for USE
CsetSafety() Sets or retrieves the safety switch used for XbToolsIII file operations.
IsDebug() Checks whether an application is controlled by the Xbase++ debugger.
NumFKey() Retrieves the number of function keys.

System Info Functions group

Useful information about a program's system environment is retrieved by functions of this group. You can query the command line parameters at any time in your application, get the full qualified file name of the EXE, or determine the entire system variables set in the CONFIG.SYS file (Note that LIBPATH is not an environment setting).

The functions NumFiles(), FilesFree() and FilesMax() used to determine file handle limitations within DOS CA-Tools III exist for compatibility reasons. The maximum number of files that can be open at a time is limited by the operating system. Return values of FilesFree() and FilesMax() may vary when the requirements for file handles are adjusted by Xbase++.

System Info Functions
Function Description
DosParam() Retrieves the command line parameters passed to an application.
EnvParam() Retrieves all environment definitions.
ExeName() Retrieves the filename of the Xbase++ application.
FilesFree() Determines how many files still can be opened.
FilesMax() Determines the maximum number of files that can be open at a time.
GetCountry() Retrieves the country code set in CONFIG.SYS
IsAnsi() Checks whether an ANSI driver is installed.
IsAT() Checks whether the program runs on an AT computer.
IsMath() Checks whether a math co-processor is available
MemSize() Determines conventional or extended memory.
NumFiles() Determines the max. number of files opened at a time by different processes.
OsVer() Retrieves the version number of the operating system
PcType() Determines the computer type.
SsetVerify() Sets or retrieves the OS/2 VERIFY setting.

Miscellaneous Functions group

In this group functions with a quite specific purpose are listed. With KbdStat(), for instance, you can determine whether or not a Ctrl, Alt, or Shift key is pressed at the moment, or you can retrieve the keyboard scan code for the last key pressed. However, the latter is not recommended to be used. Instead, only the Xbase++ function AppEvent() should be used to retrieve keyboard events from the event queue.

Miscellaneous Functions
Function Description
AlloFree() Determines free memory.
Blank() Creates an empty value for data types A,C,D,L,M,N
Complement() Creates the complement for values of data type C, D, L, M, N
DataType() Determines the data type of a value or an expression as a numeric value.
GetTic() Retrieves the number of timer ticks.
KbdStat() Determines the state of special keys like Shift, Ctrl or Alt
KbdType() Determines the keyboard type.
MilliSec() Defines a delay in units of 1/1000 of a second.
Nul() Converts any value or expression to a null string ("").
ScanKey() Waits for a key press and returns the keyboard scan code.
SetTic() Defines whether to start or to stop monitoring timer ticks.
Sound() Creates one or more tones of specified frequency and duration.
ToolVer() Retrieves the version number of XbToolsIII
XtoC() Converts values of datatype C, D, L, M, N to a string.

Mathematical Functions group

The Mathematical Functions group consists mainly of financial functions (to calculate future and present values or interest rates for loans) and trigonometric functions. Both types of functions require iterations to compute a result. Especially the trigonometric functions imply an increasing amount of calculations the more precise the result should be. For this reason the precision for trigonometric functions can be adjusted to a given task in order to gain maximum computing speed.

Mathematical Functions
Function Description
Acos() Calculates the arc cosine.
Asin() Calculates the arc sine.
Atan() Calculates the arc tangent.
Atn2() Calculates the radiant of an angle from sine and cosine.
Ceiling() Rounds a number to the next larger integer.
Cos() Calculates the cosine for an angle.
Cot() Calculates the cotangent.
DtoR() Converts an angle from degrees to radiant.
Fact() Calculates the factorial of a number.
Floor() Rounds a number to the next smaller integer.
Fv() Calculates a Future Value.
GetPrec() Retrieves computing precision for trigonometric functions.
Log10() Calculates the base 10 logarithm.
Payment() Calculates a periodical payment for loans.
Periods() Calculates the number of payments for a loan at fixed interest rate and payments
Pi() Returns Pi at maximum precision.
Pv() Calculates the Present value of a loan at fixed interest rate.
Rate() Calculates the interest rate for a loan.
RtoD() Converts angles from radiant to degrees.
SetPrec() Defines computing precision for trigonometric functions.
Sign() Determines the sign of a number as a numeric value.
Sin() Calculates the sine.
Tan() Calculates the tangent.

Get System group

This group contains some utility functions for Get entry fields useful especially when a programmer prefers the @...GET command for programming Get entry screens.

Get System
Function Description
CountGets() Determines the number of Gets in the current Getlist array.
CurrentGet() Determines the position of the current Get in the Getlist array.
GetFldCol() Retrieves the screen column position of a Get.
GetFldRow() Retrieves the screen row position of a Get.
GetFldVar() Retrieves the name of a Get variable.
GetInput() Simple Get input routine for strings.
GetSecret() Simplified hidden Get input routine for strings.
RestGets() Restores a previously saved Getlist array.
RestSetkey() Restores SetKey()s and associated code blocks.
SaveGets() Saves current Getlist array for nested gets.
SaveSetkey() Saves SetKey()s and associated code blocks.

Low level Bindery functions group

The bindery is a small database resident on each Novell NetWare file server. It contains vital information about users, groups, queues other servers etc. and is composed of what is called Bindery Objects. A bindery object (object for short) is identified by its name and type, it has properties associated with it and each property can have either a single value (property item) or multiple values (property set). Values of properties could be strings, like the PASSWORD property, or again could be objects. For instance, the GROUPS_I'M_IN property set is a list of objects of the GROUP type a user belongs to (don't confuse the term object with what is known from object oriented programming. Even you are an object in the bindery when you log in to a NetWare file server). As a conclusion, the bindery contains all information to maintain and run a network.

Low level Bindery Functions provide access to the bindery and allow to retrieve or change almost any information stored in the bindery. However, an appropriate security is necessary for most of the functions to work. If a function call fails make sure to have the required security set.

The function NnetBinClose() allows to close the bindery. Use this function with extreme care. The bindery is vital for NetWare and should be closed only for backup purposes.

Low level Bindery
Function Description
NnetAddSet() Adds a bindery object to a property set.
NnetBinAcc() Determines the user access level to the bindery.
NnetBinCl() Closes the bindery.
NnetBinOp() Opens the bindery after it has been closed with NnetBinCl().
NnetCrtObj() Creates a new bindery object.
NnetCrtPrp() Creates a new property to be associated with a bindery object.
NnetDelObj() Deletes a bindery object and all associated properties.
NnetDelPrp() Deletes a property from a bindery object.
NnetDelSet() Deletes a bindery object from a property set.
NnetInSet() Checks whether a bindery object is a member of a property set.
NnetNumMem() Determines the number of members in a property set.
NnetObjId() Retrieves the numeric ID of a bindery object from object name and type.
NnetObjNam() Retrieves the name of a bindery object from its ID.
NnetObjSec() Changes the security of a bindery object.
NnetObjTyp() Retrieves the type of a bindery object from its ID.
NnetPrpSec() Changes the security of a property.
NnetRdItm() Reads a 128-byte value segment from a property item.
NnetRdSet() Reads a property set.
NnetRenObj() Changes the name of a bindery object.
NnetScnBin() Scans the bindery for objects.
NnetScnPrp() Scans a particular bindery object for associated properties.
NnetWritItm() Changes a value segment of a property item.

User and Group Administration group

Some of the most common tasks in network maintenance is user and group administration. This could be achieved with the low level bindery functions but is more comfortably programmed with functions of this group. Just call NnetCrtUsr() or NnetCrtGrp() to create a new user or a new user group, or call NnetLgUser() to know who is currently logged in to the file server. So, functions of this group are convenient for the daily work in network administration.

User and Group Administration
Function Description
NnetAccDis() Retrieves or changes the Disabled status of a user account.
NnetAddGrp() Adds one or more users to an existing user group.
NnetAExpD() Retrieves or changes the expiry date of a user account.
NnetCoPriv() Checks whether a user has server console privileges.
NnetCPass() Changes the password of a bindery object.
NnetCrtGrp() Creates a new user group.
NnetCrtUsr() Creates a new user.
NnetGroups() Retrieves names of existing user groups.
NnetGrpMem() Checks whether a user is member of a particular user group.
NnetInGrps() Determines all user groups a user is member of.
NnetLgUser() Determines all users currently logged in to the server.
NnetMaxCon() Retrieves or changes the maximum number of connections for one user.
NnetOCNums() Retrieves the workstation numbers of open connections for one user.
NnetPExpD() Retrieves or changes the expiry date of a user password.
NnetPExpI() Retrieves or changes the expiry interval of a user password in days.
NnetPwGrce() Retrieves or changes the number of grace logins.
NnetPwLen() Retrieves or changes the minimum length for passwords.
NnetRemGrp() Removes one or more users from a user group.
NnetSprvsr() Checks whether a user has supervisory rights.
NnetUserId() Determines the user ID from user name.
NnetUsers() Retrieves user names which are defined on a file server.
NnetUsInGr() Determines all users of a particular user group.
NnetVPass() Verifys a password for a bindery object.

Connection Services group

The Connection Services group contains functions which are required for connecting/disconnecting a client workstation to/from a file server. A connection is created as a 'real login' using NnetLogin() or as a logical connection with NnetAttach(). Once a connection is established various functions can be used to retrieve information about the connection and the available file servers in the network.

Connection Services
Function Description
NnetAdr() Determines the internet address of a user.
NnetAttach() Creates a logical connection between work station and file server.
NnetCCnSrv() Counts the number of connected file servers.
NnetClrCon() Releases an existing connection number.
NnetCVsSrv() Determines the number of visible file servers in a network.
NnetDisLog() Disables a file server for log in.
NnetEnLog() Enables the file server for log in after calling NnetDisLog().
NnetFSLst() Retrieves names of visible file servers.
NnetInUse() Determines the number of connected workstations.
NnetLogged() Checks whether a workstation is connected to the file server with LOGIN.
NnetLogin() Logs a user in to a file server.
NnetLogout() Logs a user out of a file server.
NnetName() Determines a user name from an internet address.
NnetSetSrv() Defines a server as the preferred one.
NnetSlist() Determines all connected (attached) file servers.
NnetSname() Returns the name of the default file server.
NnetStaId() Determines the ID of a workstation (ID of the network board)
NnetStaNum() Determines the workstation number on the preferred file server.
NnetWhoAmI() Determines the LOGIN name of a workstation.

Capture Processes group

Capture processes are used for network printing when several client workstations share the same printer(s) connected to a file server. After a capture process is initiated with NnetCapBeg(), the output device is defined at the client workstation, for example with SET PRINTER TO LPT1. The capturing intercepts all data sent to the local printer port and redirects it to the file server where it is stored in a capture file. A call to NnetCapEnd() terminates the capturing and the capture file is sent to the network printer via the NetWare queue management system. Note that a particular print queue can be specified using the NnetSetQ() function if capturing should be processed in a print queue other than the default one (see Print Queue functions).

Capture Processes
Function Description
NnetBanner() Retrieves or changes the current banner name.
NnetCapAct() Checks whether capture mode is active for a particular LPT port.
NnetCapBeg() Begins capturing for a particular LPT port.
NnetCapCan() Cancels capturing and aborts the current print job.
NnetCapEnd() Ends capturing for a particular LPT port.
NnetCapFlu() Closes the current print job and flushes it to the printer.
NnetCapSsf() Sets specific capture flags for a particular LPT port.

Drive Administration group

Functions of the Drive Administration group allow to map paths to logical drives both permanently and temporarily. Path mappings can be set or released so an Xbase++ application can define its own network environment.

Drive Administration Functions
Function Description
NnetMap() Sets or releases drive mappings.
NnetMapInf() Retrieves the path a drive is being mapped to.
NnetMapMod() Determines the mapping mode for a drive.
NnetNxtFre() Determines the next unused drive letter.

Server Administration group

Maintenance of directories and files which reside on a file server volume is possible with Server Administration functions. You can create or remove directories on a server volume, copy files between volumes or get information about entire subdirectories. If a user has supervisory rights it is also possible to define Trustee rights on directory or file level.

Server Administration Functions
Function Description
NnetCopy() Copies files within file server volumes.
NnetDirFre() Determines the number of free directory entries on a server volume.
NnetDirMax() Determines the maximum number of directory entries on a server volume.
NnetDirs() Retrieves subdirectory information.
NnetDskUse() Determines the storage space used on a server volume by a particular user.
NnetExtAtt() Retrieves or sets Novell specific extended file attributes.
NnetFiles() Retrieves file information of a particular directory.
NnetMaxRgh() Retrieves or changes maximum (2.x) or inherited (3.x) rights for a user.
NnetMkdir() Creates a directory on a server volume.
NnetPurge() Removes files marked for deletion from a server volume.
NnetRenDir() Renames a subdirectory on a server volume.
NnetRghMsk() Returns a rights mask depending on the NetWare version.
NnetRights() Retrieves access rights to a directory on a server volume.
NnetRmDir() Removes a directory from a server volume.
NnetSalLst() Determines all files marked for deletion which can be recovered (3.x)
NnetSalvag() Recovers files marked for deletion.
NnetTrsLst() Retrieves Trustee directories and files.
NnetTrust() Defines or voids Trustee rights.
NnetUsrFre() Determines the storage space available for a particular user.
NnetVolFre() Determines the free storage space on a server volume.
NnetVolMax() Determines the maximum storage space on a server volume.
NnetVolNam() Determines the name of a server volume.
NnetVolNum() Determines the largest available server volume number.

Print Queue group

Print Queue functions allow access to the Novell print queue management system which gives maximum control for shared printing in a network. A print queue itself is a bindery object which has properties holding information about the queue operators, queue users, queue servers as well as print jobs in the queue. Each of these properties can be created or specified, modified or deleted using Print Queue functions.

A print queue is first created with the NnetCrtQ() function, then queue operators, users and print server must be specified with NnetAddQOp(), NnetAddQUs() and NnetAddQSv(). A queue operator is a user with special rights, like changing the status of a queue and prioritize or reorder jobs, whereas only queue users may place jobs in the print queue. The function NnetSetQ() then defines the new print queue as the one to process capture files (see Capture Processes). Once a capture file is placed in a print queue numerous functions can be used to retrieve (or change) job related information.

Print Queue Functions
Function Description
NnetAddQOp() Defines one or more users as operators for a particular print queue.
NnetAddQSv() Defines one or more print servers to service a particular print queue.
NnetAddQUs() Defines one or more users as new queue users of a particular print queue.
NnetCapJob() Retrieves the job number of the last opened capture process.
NnetCrtQ() Creates a new print queue.
NnetDelQ() Deletes a print queue.
NnetJBan() Retrieves or sets whether or not a banner page gets printed.
NnetJBFile() Retrieves or sets the file name that gets printed on the banner page.
NnetJBName() Retrieves or sets the job owner name that gets printed on the banner page.
NnetJCnt() Returns the number of jobs waiting in a particular print queue.
NnetJCopy() Retrieves or sets the number of copies for a particular print job.
NnetJCpl() Retrieves or sets the number of characters per line for a print job.
NnetJDel() Deletes a print job from a particular print queue.
NnetJDesc() Retrieves or sets the job description that gets printed on the banner page.
NnetJEDate() Retrieves the entry date of a print job.
NnetJETime() Retrieves the entry time of a print job.
NnetJFile() Retrieves the name of a job file.
NnetJFlags() Retrieves or sets job control flags.
NnetJForm() Retrieves or sets a form name for a print job.
NnetJList() Retrieves a string with binary numbers of jobs waiting in the queue.
NnetJLpp() Retrieves the number of lines per page for a print job.
NnetJOwner() Retrieves the login name of a print job owner.
NnetJPoint() Determines whether to process a job when capturing aborts.
NnetJPos() Retrieves or changes the position of a job in a queue.
NnetJSDate() Retrieves or sets the start date for a job.
NnetJSize() Retrieves the size of a job file in bytes.
NnetJSrv() Retrieves or sets the current print server.
NnetJSTime() Retrieves or sets the start time for a job.
NnetJSupFF() Retrieves or sets whether or not a form feed occurs at the end of a job.
NnetJTabs() Retrieves or sets the tab width for a print job.
NnetJTxt() Determines whether a job is printed as text or binary information.
NnetJWork() Checks whether a print job is currently being printed.
NnetNQSrvs() Determines the number of print servers which service a print queue.
NnetQDir() Retrieves the directory of a print queue on a server volume.
NnetQOps() Retrieves the names of queue operators
NnetQSrvs() Determines the names of print servers which service a print queue.
NnetQStat() Retrieves or changes the queue status.
NnetQUsers() Determines names of queue users.
NnetRemQOp() Removes one or more queue operators.
NnetRemQSv() Removes one ore more print queue servers.
NnetRemQUs() Removes one or more print queue users.
NnetSetQ() Defines the print queue for capture mode.

Print Job Configuration group

With its utility program PRINTCON.EXE Novell NetWare allows to configure standard print jobs. Configuration data is stored in the PRINTCON.DAT database file and is retrieved when selecting a default print job configuration to be used for capture processes.

The PRINTCON.DAT file can be accessed using functions of the Print Job Configuration group. This means, print job configuration records can be added, edited or deleted from the file, and can be selected as the default job configuration.

Print Job Configuration Functions
Function Description
NnetPjAdd() Creates a new print job configuration record in PRINTCON.DAT
NnetPjBan() Configures whether or not a banner page gets printed.
NnetPjBNam() Configures the file name that gets printed on the banner page.
NnetPjCap() Configures the Auto End Capture mode.
NnetPjCapF() Begins capturing using capture flags from a job configuration record.
NnetPjCnt() Determines the number of print job configuration records in PRINTCON.DAT
NnetPjCopy() Configures the number of copies for a print job record.
NnetPjCrt() Creates an empty print job configuration file (= PRINTCON.DAT)
NnetPjDef() Retrieves or sets the default job configuration record.
NnetPjDel() Deletes a job configuration record from PRINTCON.DAT
NnetPjDev() Configures the device name for a print job record.
NnetPjForm() Configures the form name for a print job configuration record.
NnetPjFSrv() Configures the file server name for a print job record.
NnetPjList() Retrieves the names of print job configuration records for a user.
NnetPjLpt() Configures the local LPT port for a print job configuration record.
NnetPjMode() Configures the device mode for a print job configuration record.
NnetPjNoty() Configures the notification mode for a print job configuration record.
NnetPjPSrv() Configures the print server name for a print job record.
NnetPjQ() Configures the print queue name for a print job record.
NnetPjSupf() Configures whether or not a form feed is issued at the end of a job.
NnetPjTabs() Configures the tab width for a print job configuration record.
NnetPjTxt() Configures text or binary mode for a print job record.
NnetPjUsr() Configures the job owner name that gets printed on the banner page.
NnetPjWait() Configures the time out for a print job configuration record.

Print Server group

A print job sent from a client workstation is stored temporarily in a print queue on the file server before it actually gets printed. It is then the print server's responsibility to take print jobs out of a print queue and send them on to a physical printer when this is ready to print. Functions of the Print Server group are used to access a print server and to retrieve information about it. This includes information about the current job being printed as well as status information about a printer serviced by the print server. Also, bindery objects can be defined (normally users) to receive notification messages from the print server when a job is done or if the printer is out of paper.

Print Server Functions
Function Description
NnetPsAcc() Determines access rights to a print server.
NnetPsAddQ() Assigns a printer serviced by a print server to a queue.
NnetPsAJob() Tells a print server to abort the currently printed job.
NnetPsAno() Assigns a bindery object to a print server for notifications.
NnetPsArp() Determines available remote printers.
NnetPsCanD() Cancels Print Server Down request.
NnetPsChgQ() Changes priority of a print queue .
NnetPsCno() Changes notification intervals for a print server.
NnetPsDelQ() Removes a printer serviced by a print server from a queue.
NnetPsDno() Deletes a bindery object from a print server notify list.
NnetPsDown() Issues Print Server Down request.
NnetPsErr() Determines the error code of the last print server operation.
NnetPsFF() Sends a Form Feed to a printer serviced by a print server.
NnetPsJByt() Determines the number of bytes already printed for the current job.
NnetPsJDsc() Retrieves the description of the current job.
NnetPsJFrm() Retrieves the form number of the current job.
NnetPsJFs() Retrieves the file server's name of the current job.
NnetPsJNo() Retrieves the unique job number of the current job.
NnetPsJPco() Retrieves the number of printed copies of the current job.
NnetPsJQ() Retrieves the name of the print queue of the current job.
NnetPsJSiz() Retrieves the size of the current job in bytes.
NnetPsJTco() Retrieves the number of total copies for the current job.
NnetPsJTxt() Checks whether the current job contains text or binary information.
NnetPsLIn() Logs a print server in to a file server.
NnetPsLOut() Logs out a print server from a file server.
NnetPsMToF() Marks the Top of Form on a printer serviced by a print server.
NnetPsNMod() Retrieves the number of print queue service modes.
NnetPsNotL() Retrieves information about notify objects assigned to a print server.
NnetPsnPrn() Retrieves the number of printers serviced by a print server.
NnetPsPFrm() Retrieves or sets a form for a printer serviced by a print server.
NnetPsPJob() Checks whether a printer currently is printing a job.
NnetPsPMod() Retrieves or changes the print queue service mode for a printer.
NnetPsPNam() Retrieves the name of a printer from its number.
NnetPsProb() Identifies problems with a printer serviced by a print server.
NnetPsPSQ() Retrieves a list of printers servicing a queue.
NnetPsPSta() Retrieves status information about a printer serviced by a print server.
NnetPsQL() Retrieves information about queues serviced by a printer.
NnetPsRRP() Requests remote printer.
NnetPsSRM() Sets the remote printer mode.
NnetPsSrvL() Retrieves a list of file servers a print server is logged in to.
NnetPsStat() Retrieves status of a print server.
NnetPStart() Starts a printer after it has been stopped using NnetPStop().
NnetPStop() Stops a printer serviced by a print server.
NnetPsType() Determines the type of a print server.
NnetPsVer() Determines the version of a print server.

Semaphores group

A semaphore can be viewed as a numeric variable visible to all client stations connected to a file server. An application running on a client workstation can open, examine, wait for (=decrement), signal (=increment) and close a semaphore. Thus, semaphores are useful when applications simultaneously access resources located on a file server and the application must be able to detect whether or not the same resource is used by another client workstation. This allows, for instance, to limit the number of users running an application at the same time to a fixed amount.

As with files opened with FOpen(), a semaphore is opened passing a name to the NnetSemOpn() function which returns a numeric handle to the semaphore. When the application wants to access a semaphore protected resource, it calls NnetSemWai(), does the desired operations with that resource and calls NnetSemSgn() to signal to other client stations that the resource is no longer in use. When the semaphore is no longer required it is closed by calling NnetSemClo().

Semaphores
Function Description
NnetSemClo() Closes a semaphore.
NnetSemOpC() Retrieves the number of workstations which have opened a semaphore.
NnetSemOpn() Opens a semaphore and initializes it.
NnetSemSgn() Signals a semaphore (Increments a semaphore value).
NnetSemVal() Retrieves the current semaphore value.
NnetSemWai() Waits for a semaphore to become available (decrements semaphore value)

Novell TTS group

There are seven functions available in XbToolsIII that let you take advantage of NetWare's Transaction Tracking System (TTS). With its TTS, NetWare guarantees a set of data writes to be entirely written to a database or to be voided once a transaction fails to complete, thus leaving a database in its pre-transactional state. All files that are to be monitored by the TTS must be marked as transactional. Use the FILER.EXE utility or function NnetExtAtt() to set the EXA_TTS extended file attribute for all files participating in TTS. This includes database (DBF), memo (DBT) and index (NTX) files.

Note

When you intend to use the TTS we strongly recommend you to disable NetWare's implicit transactions, otherwise your application might loose control over the start and the end of transactions. Type SETTTS 255 255 on the command line of a logged in client workstation to disable implicit transactions. Also, you must design your application to fit into NetWare's TTS. This means, your application must be aware of the fact that a physical lock is set by NetWare on a changed database record.

As a general rule, NetWare's TTS locks a record physically and Xbase++ locks a record logically. Do not confuse logical and physical locks when using TTS functions. For shared access to a database you must lock a record logically (function Rlock() or DbRlock()) before Xbase++ allows you to change a record. When the database participates in NetWare's TTS (function NnetTTSBeg()) a changed record becomes unreadable to other workstations until the transaction is complete (function NnetTTSEnd()). The reason for this is that NetWare sets a physical lock on a changed record. Any access to a record that is part of a transaction and is physically locked results in a runtime error in your Xbase++ application on all workstations other than the one that initiates the transaction. As a consequence, even when you read a database field you must protect your application against runtime errors using a BEGIN SEQUENCE... RECOVER... END structure or you should use semaphores before you start a transaction (refer to the TRANSACT.PRG sample program found in ..\SAMPLES\NETWARE)

Novell TTS Functions
Function Description
NnetDisTTS() Disables the Transaction Tracking System (TTS)
NnetEnTTS() Enables the Transaction Tracking System (TTS)
NnetIsTTS() Checks whether the Transaction Tracking System is available and/or active.
NnetTTSAb() Aborts the current transaction.
NnetTTSBeg() Begins a transaction.
NnetTTSEnd() Ends a transaction.
NnetTTSSta() Determines the status of a transaction when it is finished.

Miscellaneous Network Functions group

This group contains a variety of functions to retrieve information about the file server and its environment. The two functions HexToStr() and StrToHex() are no network functions but used for converting strings from binary to hexadecimal format. This is useful, for instance, to decode the internet address of a workstation as returned by the function NnetAdr().

Miscellaneous Network Functions
Function Description
HexToStr() Converts a string coding a hex number to a string in binary format.
NnetDown() Shuts the file server down.
NnetError() Returns the Novell error code of the last function executed.
NnetInfo() Retrieves information about the current network software.
NnetSDate() Retrieves the system date of the file server.
NnetSerNo() Retrieves the NetWare serial number.
NnetSftLvl() Retrieves the System Fault Tolerance level of the default file server.
NnetSTime() Retrieves the system time of the file server.
NnetVer() Retrieves the NetWare version number for a mapped drive.
NnetWork() Checks whether a Novell network is active.
StrToHex() Converts a binary string to a string of hex numbers.

Point to Point Communication group

Functions in this group are used to establish direct communication between client workstations in a network using NetBIOS datagram or session services. Datagrams provide a simple transmission service with powerful broadcast capabilities. They can be sent to a named entity like a single workstation, a group of stations or to all users in a network. However, they are not reliable since they are not acknowleged or tracked through an identification number. They may or may not be received. For a secure point to point communication NetBIOS sessions can be used where exchanged data is acknowledged and tracked.

Before using NetBIOS datagram or session services function NbReset() must be called in order to allocate rescources for a process's exclusive use from the NetBIOS environment. Then logical names for workstations and groups must be added to the local name table using NbAddName() or NbAddGroup(). Note that the local name table is visible to all workstations in a network which use NetBIOS services. Function NbAddName() is used to define a unique logical name for a workstation. If this name exists already in a network it will not be added to the local name table. However, multiple workstations may add the same group name to the name table using NbAddGroup().

NetBIOS communication is based on handles (like file handles). Use function NbDOpen() to obtain a communication handle for datagram services, or functions NbSCall() and NbSListCon() to get handles for session services. While NbSCall() attempts to open a session with a specified workstation the function NbSListCon() allows to accept remote session requests (it listens for a connection), either from a named partner or from any station in the network.

Once a connection is established you can use Ppc..() functions, like PpcRead() and PpcWrite(), to exchange data via the communication handle. Outgoing data is copied to the send buffer and incoming data is stored in the receive buffer. Both buffers are limited to 64kByte in size so data can get lost if either buffer is full. Functions PpcRecCnt()/PpcSndCnt() and PpcRecFree()/PpcSndFree() are used to determine how many bytes are stored in the buffers and how many free space is left respectively.

Important

When your program calls NetBIOS functions in conjunction with multiple threads (Xbase++ Thread objects) you can use a communication handle obtained with NbdOpen(), NbSCall() or NbSListCon() only in the thread that has executed either of these functions. As a consequence, a particular communication handle can be used only by one thread. However, you may establish multiple connections from multiple threads between the same workstations.

Point to Point Communication
Function Description
NbAddGroup() Adds a NetBIOS group name to the local name table.
NbAddName() Adds the NetBIOS name of the workstation to the local name table.
NbDelName() Deletes a NetBIOS name from the local name table.
NbDOpen() Opens NetBIOS send and receive buffers for datagram services.
NbError() Retrieves the error code of the last NetBIOS call.
NbName() Reads NetBIOS names from a workstation's name table.
NbNameCnt() Determines the number of NetBIOS names in the name table.
NbNameNum() Retrieves the number of a NetBIOS name.
NbNameStat() Determines the status of a NetBIOS name.
NbReset() Resets the NetBIOS adapter.
NbSCall() Opens the NetBIOS session buffers.
NbSConTarg() Determines the connected target station during a NetBIOS session.
NbSListCon() Opens NetBIOS session buffers and listens for remote connection requests.
PpcBufTyp() Determines a communication buffer's type.
PpcCancel() Closes a communication handle and deletes associated buffers.
PpcConAct() Checks whether a NetBIOS session is active.
PpcRead() Reads data from a communication receive buffer.
PpcRecCnt() Retrieves the number of bytes waiting in the receive buffer.
PpcRecDisc() Determines the number of discarded data packages.
PpcRecErr() Retrieves the last receive error code.
PpcRecFail() Determines the number of received data packages with errors.
PpcRecFlsh() Flushes the receive buffer.
PpcRecFree() Determines the number of unused bytes in the receive buffer.
PpcRecSize() Determines the size of the receive buffer.
PpcRecTot() Determines the total received data packages.
PpcSndCnt() Determines the number of bytes waiting in the send buffer.
PpcSndErr() Retrieves the last send error code.
PpcSndFail() Determines the number of sent data packages with errors.
PpcSndFlsh() Flushes the send buffer.
PpcSndFree() Determines the number of unused bytes in the send buffer.
PpcSndSize() Determines the size of the send buffer.
PpcSndTot() Determines the total sent data packages.
PpcWrite() Writes data to the send buffer.

Printer and Forms group

The Printer and Forms functions access the NetWare database which is normally administered with the utility PRINTDEF.EXE. It contains configuration data about printers and forms. Thus an Xbase++ application can take advantage of standard configurations for network printers.

Printer and Forms
Function Description
NnetPDev() Retrieves the names of defined print devices.
NnetPFlen() Retrieves the page length of a defined form (Lines Per Page)
NnetPFnum() Determines the number of a defined form from its name.
NnetPForms() Retrieves the names of defined forms.
NnetPFunCo() Retrieves escape sequences of a device function for a defined device.
NnetPFuncs() Retrieves names of device functions for a defined device.
NnetPFwdth() Retrieves the page width of a defined form (Characters Per Line)
NnetPModes() Retrieves names of print mode definitions for a defined device.
NnetPModFu() Retrieves the names of device functions contained in a mode definition.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.