home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / p_setup / readme.txt < prev   
Text File  |  1992-11-12  |  4KB  |  99 lines

  1. Though the printer setup dialog box associated with each Windows 3.0 
  2. printer driver is normally accessed through the Windows Control 
  3. Panel, it is often convenient to allow users to modify printer 
  4. settings directly from Visual Basic applications and Turbo Pascal for
  5. Windows For this reason, PSETUP.DLL was created.
  6.  
  7. Files included with PSETUP.DLL:
  8.  
  9. README.TXT - This documentation file.
  10.  
  11. PRSEL.MAK  - Visual Basic makefile for the sample application.
  12. PRSEL.BAS  - Global variables, types & declarations for sample app.
  13. PRSEL.FRM  - Visual Basic form for printer select dialog box.
  14. FORM1.FRM  - Visual Basic form calling printer select dialog box.
  15.  
  16. PSETUP.PAS   TPW Source code for PSETUP.DLL
  17. PSETUP.DLL - DLL providing print setup interface.
  18.  
  19. PSETUP.DLL contains one function (CallPSetup()), called by a Visual
  20. Basic application, that calls the ExtDeviceMode() function located in 
  21. all Windows 3.0 printer drivers.  The CallPSetup() DLL function
  22. brings up a dialog box displaying printer settings specific to each 
  23. printer, and allows the user to modify those settings, saving them to 
  24. an .INI file.
  25.  
  26. The function declaration for CallPSetup() will appear as:  (NOTE: the
  27. following declaration is broken into several lines for readability.  
  28. In the actual Visual Basic application, it should be on a single 
  29. line.)
  30.  
  31. Declare Function CallPSetup Lib "PSETUP.DLL" (ByVal hWnd%,
  32.                                               ByVal Driv$,
  33.                                               ByVal Dev$,
  34.                                               ByVal Port$,
  35.                                               ByVal INI$) As Integer
  36.  
  37. Where: 
  38.  
  39. hWnd% is the calling form's window handle. ie: Form1.hWnd.
  40.  
  41. Driv$ should be a variable-length string containing the print driver 
  42. filename ie: "HPPCL.DRV"  Note: this can be obtained from the WIN.INI 
  43. file via the API calls GetProfileString() or 
  44. GetPrivateProfileString() and, since this is a filename, the .DRV 
  45. extension must be added to the end of the name.
  46.  
  47. Dev$ should be a variable-length string containing the device name of 
  48. the printer ie: "PCL / HP LaserJet" (Also available from the WIN.INI 
  49. file.)
  50.  
  51. Port$ should be a variable-length string containing the actual 
  52. printer port name for print driver to send output to ie: "LPT1:" 
  53. (Available from the WIN.INI file.)
  54.  
  55. INI$ should be a variable-length string set to the name of the .INI 
  56. file to be modified by CallPSetup(). (Should normally be set to
  57. "WIN.INI".  If though, your application has it's own .INI file 
  58. associated with it, INI$ should be set to the name of your custom 
  59. .INI file.
  60.  
  61. RETURNS:  An integer value indicating the success of the CallPSetup()
  62. function.  If the OK button was pressed to exit the setup dialog box, 
  63. a value IDOK (1) will be returned.  If the CANCEL button was pressed, 
  64. a value IDCANCEL (2) will be returned.  If the dialog failed to open, 
  65. a value less than zero will be returned.
  66.  
  67. Using the sample application:
  68.  
  69. To use the sample application provided (PRSEL),Copy the files
  70. to a directory on your hard disk and copy PSETUP.DLL to
  71. your WINDOWS directory.  Then, start up Visual Basic and open the 
  72. project PRSEL.MAK.  From here, run the application (press F5).  To 
  73. access the printer selection dialog, select Printer Setup... from the 
  74. application's file menu.  This will display a dialog box containing a 
  75. list of available printer drivers (as found in the WIN.INI file) with 
  76. the current default printer highlighted.  At this point, there are 
  77. four options:
  78.  
  79. * Select a printer via the listbox.
  80.  
  81. * Choose the Setup button to bring up the print setup dialog box for 
  82. the currently selected printer driver.
  83.  
  84. * Choose the Cancel button to abort any new printer selections and 
  85. return to the calling form.  Note: any changes made from the print 
  86. setup dialog specific to each printer will be saved regardless of 
  87. whether Cancel or OK are pressed.
  88.  
  89. * Choose the OK button to save the new default printer to the WIN.INI 
  90. file.
  91.  
  92.  
  93. References:
  94.  
  95. PSETUP.DLL is written in Turbo Pascal for Windows, and the source code is
  96. provided in PSETUP.PAS. Advanced programmers can optionally modify and
  97. rebuild PSETUP.DLL by using Turbo Pascal for Windows.
  98.  
  99.