home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / VBasic / PPRTR3.ZIP / READ.ME < prev   
Encoding:
Text File  |  1993-05-23  |  14.2 KB  |  322 lines

  1. PPRTR.DLL copyright 1993 Paul F. Poellinger
  2. -------------------------------------------------------------------
  3.  
  4. Included:
  5.  
  6. PPRTR    DLL                 The real deal
  7. READ     ME                  self-reference (this)
  8. PPRTR    FRM                 .. \    Visual Basic
  9. PPRTR    MAK                   ..>   (version 2.0)
  10. PPRTR    BAS                 .. /    Example of PPrtr functions
  11. PPGLOBAL TXT                 VB constants
  12. PPRTR    LIB                 Import library for C
  13. PRINT    TXT                 constant definitions from C header file
  14. DEVCAP   TXT                 device cap definitions from C hdr file
  15.  
  16. functions:
  17.  
  18.     PPrtr -- allows retrieval or change to any attribute of the default
  19.              printer
  20.  
  21.     DefPrtr -- allows you to find out or change the default printer
  22.  
  23.     Prtrs -- returns semi-colon delimeted list of available active
  24.              printers
  25.  
  26.     PrtrCap -- returns structure (VB type) containing default printer
  27.                device capabilities
  28.  
  29.     GetPrtr -- returns the name of the current default printer
  30.  
  31. -----------------------------------------------------------------------
  32.  
  33. function prototypes:          ( in C format ) :
  34.  
  35.     int FAR PASCAL PPrtr (HWND hwndx, int selection, int NewValue, int action);
  36.     int FAR PASCAL Prtrs (LPSTR szActives);
  37.     int FAR PASCAL DefPrtr (LPSTR szNewPrinter, LPSTR szOldPrinter);
  38.     int FAR PASCAL GetPrtr (LPSTR szPrtr);
  39.     int FAR PASCAL GetPort (LPINT szPort);
  40.     int FAR PASCAL PrtrCap (LPINT nDevCap);
  41.  
  42. -----------------------------------------------------------------------
  43.  
  44. function definitions:         ( in Visual Basic format ) :
  45.  
  46.     ******************************** PPrtr **********************************
  47.  
  48.     Declare Function PPrtr Lib "PPRTR.DLL" (ByVal hWnd As Integer, ByVal ppSelection As Integer, ByVal PPNewValue As Integer, ByVal ppAction As Integer) As Integer
  49.  
  50.           where:    hWnd ................ is a window handle
  51.                     ppSelection ......... is the selected printer device
  52.                                            attribute to get/change.
  53.                                       ... NOTE that not all printers
  54.                                            support all actions (e.g. my
  55.                                            Epson LX-800 doesn't support
  56.                                            PaperLength or PaperWidth)
  57.                     ppNewValue .......... is the value to change it to
  58.                                       ... (anything will do call is a
  59.                                            gimme, no change )
  60.                                       ... see PPGLOBAL.TXT for available
  61.                                            values
  62.                     ppAction ............ is the action requested
  63.                                       ...  0 = gimme current value
  64.                                       ...  1 = change it to ppNewValue
  65.              returns ......... integer of value of selected attribute
  66.                                 before the call
  67.                            ... 996 when the ppSelection is not supported
  68.                                    by the default printer driver
  69.                            ... 997 for a bad ppSelection code parameter
  70.                            ... 998 for a bad ppAction code parameter
  71.                            ... 999 when it can't find printer/driver info
  72.  
  73.     ppSelection:
  74.         DM_ORIENTATION = &H1
  75.         DM_PAPERSIZE = &H2
  76.         DM_PAPERLENGTH = &H4
  77.         DM_PAPERWIDTH = &H8
  78.         DM_SCALE = &H10
  79.         DM_COPIES = &H100
  80.         DM_DEFAULTSOURCE = &H200
  81.         DM_PRINTQUALITY = &H400
  82.         DM_COLOR = &H800
  83.         DM_DUPLEX = &H1000
  84.         DM_YRESOLUTION = &H2000
  85.         DM_TTOPTION = &H4000
  86.  
  87.  
  88.     Samples:
  89.  
  90.         PPrtr(hWnd, DM_PAPERSIZE, PP_UNNEEDED, PP_GIMME))
  91.         PPrtr(hWnd, DM_ORIENTATION, PP_UNNEEDED, PP_GIMME))
  92.  
  93.         PPrtr(hWnd, DM_ORIENTATION, DMORIENT_PORTRAIT, PP_CHANGE_IT))
  94.         PPrtr(hWnd, DM_PAPERSIZE, DMPAPER_LEGAL, PP_CHANGE_IT))
  95.  
  96.     C programmers...the relavent header file for this call is PRINT.H
  97.                     (in Borland C++)
  98.     ******************************** DefPrtr *******************************-
  99.  
  100.     Declare Function DefPrtr Lib "PPRTR.DLL" (ByVal newone As String, ByVal oldone As String) As Integer
  101.  
  102.        where:  newone .. is a string corresponding to the
  103.                          right side of the "=" in the
  104.                          [devices] section of WIN.INI
  105.                          for the printer to become the
  106.                          default printer...e.g.
  107.  
  108.                                     [devices]
  109.                                     HP LaserJet Series II=HPPCL,LPT1:
  110.                                     ^^^^^^^^^^^^^^^^^^^^^ <- this part
  111.  
  112.                          You can also read the printer name in the
  113.                          control panel printers dialog box.  It shows
  114.                          printer names followed by "on xxxx:" where
  115.                          xxxx is a port.  Don't use one where it says
  116.                          "on None".
  117.  
  118.                                     HP LaserJet Series II on LPT1:
  119.                                     ^^^^^^^^^^^^^^^^^^^^^ <- this part
  120.  
  121.                          This is case insensitive, but otherwise must
  122.                          be identical.
  123.  
  124.                          Note: the printer must have been
  125.                          made "active" in the control panel
  126.                          printers applet...it'll show "None"
  127.                          for a port if it's not...e.g.
  128.  
  129.                             active -> HP LaserJet Series II=HPPCL,LPT1:
  130.                             not ----> HPGL Plotter=MGXHPGL,None
  131.  
  132.                          Passing this parameter as an empty string or
  133.                          unrecognizable string results in a 998 error, but
  134.                          does return the name of the current printer
  135.                          in the "oldone" parameter...thus, allowing
  136.                          retrieval of the name of the current default
  137.                          printer without changing anything:
  138.  
  139.                             currentptr$ = String$(255, 0)
  140.                             i = DefPrtr("", currentptr$)
  141.  
  142.        where:  oldone .. is a string in which the function will return
  143.                          the default printer before your call.
  144.  
  145.                          Save this for use as "newone" to reset the
  146.                          printer to the prior default printer when
  147.                          and if you desire to do so.
  148.  
  149.                          Note: in Visual Basic you must pre-load a
  150.                          string which is to be filled by a called
  151.                          function...e.g.
  152.  
  153.                             oldptr$ = String$(255, 0)
  154.                             i = DefPrtr("HP LaserJet Series II", oldptr$)
  155.  
  156.        returns:          0   = successful
  157.                          999 = Unable to write to WIN.INI ... this
  158.                                is a system problem.
  159.                          998 = The "newone" printer was not found in
  160.                                [devices] section of WIN.INI
  161.                                ... be sure you've put in all spaces
  162.                          997 = The "newone" printer was found, but it
  163.                                is not "active"...i.e. its port is
  164.                                "None"
  165.  
  166.  
  167.     Sample:
  168.        Declare Function DefPrtr Lib "PPRTR.DLL" (ByVal newone As String, ByVal oldone As String) As Integer
  169.  
  170.        //---- change to LaserJet ---------------------
  171.        oldprinter$ = String$(255, 0)
  172.        i = DefPrtr("HP LaserJet Series II", oldprinter$)
  173.        //----
  174.        .
  175.        .    print to LaserJet
  176.        .
  177.        //---- change back to original printer --------
  178.        dontcare$ = String$(255, 0)
  179.        i = DefPrtr(oldprinter$,dontcare$)
  180.  
  181.     ******************************** Prtrs *******************************-
  182.  
  183.     Declare Function Prtrs Lib "PPRTR.DLL" (ByVal pList As String,) As Integer
  184.  
  185.        where:  pList ... is a string for the return of a list of
  186.                          available active printers.
  187.  
  188.                          The list only contains the names of "active"
  189.                          printers.  The printer must have been
  190.                          made "active" in the control panel
  191.                          printers applet...it'll show "None"
  192.                          for a port if it's not...e.g.
  193.  
  194.                             active -> HP LaserJet Series II=HPPCL,LPT1:
  195.                             not ----> HPGL Plotter=MGXHPGL,None
  196.  
  197.                          Note: in Visual Basic you must pre-load a
  198.                          string which is to be filled by a called
  199.                          function...e.g.
  200.  
  201.                             plist$ = String$(255, 0)
  202.                             i = Prtrs(plist$)
  203.  
  204.                          The active printer names are separated by
  205.                          semi-colons (;), e.g.
  206.  
  207.                               Epson LX-800;HP LaserJet Series II
  208.  
  209.        returns ....... 0 if no active printers found, or
  210.                        unable to access [drivers] section in WIN.INI
  211.                ....... the length of the returned string
  212.  
  213.     ******************************** PrtrCap *******************************-
  214.     Declare Function PrtrCap Lib "PPRTR.DLL" (ndc As DEVCAP) As Integer
  215.        where:  ndc .. is a structure (VB type definition) containing the
  216.                       device capability variable definitions:
  217.  
  218.                       Type devcap
  219.                            DRIVERVERSION As Integer
  220.                            TECHNOLOGY    As Integer ' bits
  221.                            HORZSIZE      As Integer
  222.                            VERTSIZE      As Integer
  223.                            HORZRES       As Integer
  224.                            VERTRES       As Integer
  225.                            BITSPIXEL     As Integer
  226.                            PLANES        As Integer
  227.                            NUMBRUSHES    As Integer
  228.                            NUMPENS       As Integer
  229.                            NUMMARKERS    As Integer
  230.                            NUMFONTS      As Integer
  231.                            NUMCOLORS     As Integer
  232.                            PDEVICESIZE   As Integer
  233.                            CURVECAPS     As Integer ' bits
  234.                            LINECAPS      As Integer ' bits
  235.                            POLYGONALCAPS As Integer ' bits
  236.                            TEXTCAPS      As Integer ' bits
  237.                            CLIPCAPS      As Integer ' bits
  238.                            RASTERCAPS    As Integer ' bits
  239.                            ASPECTX       As Integer
  240.                            ASPECTY       As Integer
  241.                            ASPECTXY      As Integer
  242.                            LOGPIXELSX    As Integer
  243.                            LOGPIXELSY    As Integer
  244.                            SIZEPALETTE  As Integer
  245.                            NUMRESERVED  As Integer
  246.                            COLORRES     As Integer
  247.                       End Type
  248.  
  249.                       See the PPGlobal.txt file for 'bit' field masks;
  250.                       and see the VB example for sample usage.  See the
  251.                       windows SDK documentation for explanation of the
  252.                       dev cap fields.
  253.  
  254.        Returns 0 always.
  255.  
  256.     ******************************** GetPrtr *******************************-
  257.     Declare Function GetPrtr Lib "PPRTR.DLL" (ByVal DefP As String) As Integer
  258.        where:  DefP .. is a string set up to receive the name of the
  259.                        current default printer.
  260.  
  261.                        Note: in Visual Basic you must pre-load a
  262.                        string which is to be filled by a called
  263.                        function...e.g.
  264.  
  265.                           defptr$ = String$(255, 0)
  266.                           i = GetPrtr(defptr$)
  267.  
  268.       Returns 0 -- and printer name in the string if successful;
  269.                    if not, string is as you initialized it.
  270.  
  271.     ******************************** GetPort *******************************-
  272.     Declare Function GetPort Lib "PPRTR.DLL" (ByVal DefP As String) As Integer
  273.        where:  DefP .. is a string set up to receive the name of the
  274.                        current default printer port.
  275.  
  276.                        Note: in Visual Basic you must pre-load a
  277.                        string which is to be filled by a called
  278.                        function...e.g.
  279.  
  280.                           defptr$ = String$(255, 0)
  281.                           i = GetPort(defptr$)
  282.  
  283.       Returns 0 -- and printer name in the string if successful;
  284.                    if not, string is as you initialized it.
  285.  
  286. --------------------------------------------------------------------
  287. This DLL contains, fixes, improves on and replaces PPRTR.ZIP distributed
  288. earlier this year.  That DLL contained a coding error for the "copies"
  289. setting.  It has been extensively tested by me and friends, but YMMV.
  290.  
  291. A tip of the pelican's beak to OsoSoft George Campbell who suggested the
  292. original idea for this DLL.
  293.  
  294. Hope these are helpful.  There are others (see WINP1.1, ORIENT.ZIP,
  295. PPFONT.ZIP in the Compuserve MSBASIC forum, Pel*Ican coming soon).
  296.  
  297. You are free to try this DLL for 30 days.
  298.  
  299. If you decide to use it thereafter, you are obligated to send $10 to
  300.                      PAUL POELLINGER
  301.                      2019 Round Lake Drive
  302.                      Houston, TX  77077
  303. After doing so, you are free to use it in your applications, and
  304. to distribute it with such applications, as long as you do not
  305. charge separately for the DLL or publish its calling conventions.
  306.  
  307. If you paid for the earlier version, you've paid for this one.
  308. I and all those dependent on me thank you.
  309.  
  310. You are free to pass this package on to others or upload it to
  311. bulletin boards provided that 1) you do not charge for it above
  312. the cost of distribution, and 2) all parts of the package are
  313. included (see "included" at the top).
  314.  
  315. Thank you for supporting shareware.
  316. -------------------------------------------------------------------
  317. Let me know if you have any trouble or suggestions.
  318.  
  319.       Paul Poellinger
  320.       Compuserve 70732,3576
  321.                                       5-1-93
  322.