Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- LanMan Library Reference Guide - <b>lm_setprstring()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 LM_SETPRSTRING()
 Set a network printer setup string
------------------------------------------------------------------------------

 Syntax

      LM_SetPrString( <cPrinter>, <cString> ) -> lSuccess

 Arguments

     <cPrinter> is a local printer port name (for example "LPT3:")
     which is already is use to redirect a printer on the network.

     <cString> is the desired setup string to use with the printer

 Returns

     <lSuccess> which is set to .T. if the operation succeeded and .F.
     if it did not succeed

 Description

     LM_SetPrString() is used to assign a setup string to a network
     printer. This string will then be output on the printer at the top
     of the first page of each print job. It can be used for example for
     setting up page orientation or font selection or for calling a macro
     (provided, of course, that the printer supports it). Or it can be
     used to print any text you wish at the top of the job, for example for
     identifying the workstation fron which the print job was sent. The
     length of the setup string seems to be limited to 64 bytes.

     NOTE: To print the setup string on every page, each page must be
     started with "set printer to (cPrinter)". If it is not, the string
     will only be printed on the first page.

     The setup string is valid until it is replaced with another string
     or the redirection is cancelled. It is not possible to remove an
     existing setup string by replacing it with an empty string. However,
     depending on the properties of the printer itself, setting the setup
     string to the printer's reset command may accomplish the same thing.
     In the case of a HP LaserJet, for example, setting the setup string
     to chr(27)+'E' seems to solve the problem. But this also means that
     a reset will be issued at the start of every new print job.

     WARNING: If for example fonts or macros are downloaded while a setup
     string is active, a (normally empty) page will be printed after the
     download even if there was no intention to print anything at that
     momemt.

     LM_SetPrString() calls the DOS 3.1 networking function 5E02h to set
     the setup string. If the function call fails, the DOS error code can
     be retrieved by calling LM_Ferror(). NOTE: This function may not be
     supported in all Windows versions.

     LM_SetPrString() requires FT_Int86() and supporting functions from
     the Nanforum Toolkit and its companion CPMI library. It is supposed
     to work on any computer running DOS 3.1 or higher.

 Examples

     local cLocalName := 'LPT3'
     local cString := chr(27)+'&l1O'+chr(27)+'&f31y3X'
     // This string will set a HP LaserJet to print in landscape mode
     // and print a macro previously downloaded with ID number 31 on
     // each of the two test pages below.
     local lSuccess,nPage
     lSuccess := LM_SetPrString(cLocalName,cString)
     if lSuccess
        ? 'The setup string for "' + cLocalName + '" was set'
        for nPage := 1 to 2
           set printer to (cLocalName)   // Must be done on every page
           set device to printer
           @ prow(),pcol() say 'Testing the network printer setup string'
           eject
           set device to screen
           set printer to
        next
     else
        ? 'Could not set the setup string (Error ' +;
        ltrim(str(LM_Ferror())) + ')'
     endif

 Source: SETSTRNG.PRG

 Author: Klas Engwall <klas.engwall@engwall.com>

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson