home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / crpedemo / selectpr.frm < prev    next >
Text File  |  1994-12-14  |  3KB  |  125 lines

  1. VERSION 2.00
  2. Begin Form Selectprt 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Select Printer"
  5.    ClientHeight    =   2415
  6.    ClientLeft      =   3090
  7.    ClientTop       =   3195
  8.    ClientWidth     =   4470
  9.    Height          =   2820
  10.    Left            =   3030
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   2415
  13.    ScaleWidth      =   4470
  14.    Top             =   2850
  15.    Width           =   4590
  16.    Begin CommandButton Command3 
  17.       Caption         =   "Help"
  18.       Height          =   375
  19.       Left            =   3000
  20.       TabIndex        =   8
  21.       Top             =   1665
  22.       Width           =   1185
  23.    End
  24.    Begin CommandButton Command2 
  25.       Cancel          =   -1  'True
  26.       Caption         =   "Cancel"
  27.       Height          =   360
  28.       Left            =   1680
  29.       TabIndex        =   4
  30.       Top             =   1680
  31.       Width           =   1215
  32.    End
  33.    Begin CommandButton Command1 
  34.       Caption         =   "OK"
  35.       Default         =   -1  'True
  36.       Height          =   360
  37.       Left            =   360
  38.       TabIndex        =   3
  39.       Top             =   1680
  40.       Width           =   1215
  41.    End
  42.    Begin TextBox PtName 
  43.       Height          =   285
  44.       Left            =   1440
  45.       TabIndex        =   2
  46.       Top             =   1155
  47.       Width           =   2895
  48.    End
  49.    Begin TextBox PrtName 
  50.       Height          =   285
  51.       Left            =   1440
  52.       TabIndex        =   1
  53.       Top             =   675
  54.       Width           =   2895
  55.    End
  56.    Begin TextBox DrvName 
  57.       Height          =   285
  58.       Left            =   1440
  59.       TabIndex        =   0
  60.       Top             =   195
  61.       Width           =   2895
  62.    End
  63.    Begin Label Label3 
  64.       BackColor       =   &H00C0C0C0&
  65.       Caption         =   "Port Name"
  66.       Height          =   255
  67.       Left            =   120
  68.       TabIndex        =   7
  69.       Top             =   1200
  70.       Width           =   1215
  71.    End
  72.    Begin Label Label2 
  73.       BackColor       =   &H00C0C0C0&
  74.       Caption         =   "Printer Name"
  75.       Height          =   255
  76.       Left            =   120
  77.       TabIndex        =   6
  78.       Top             =   720
  79.       Width           =   1215
  80.    End
  81.    Begin Label Label1 
  82.       BackColor       =   &H00C0C0C0&
  83.       Caption         =   "Driver Name"
  84.       Height          =   255
  85.       Left            =   120
  86.       TabIndex        =   5
  87.       Top             =   240
  88.       Width           =   1215
  89.    End
  90. End
  91.  
  92. Sub Command1_Click ()
  93.  
  94. Dim DriverName$, PrinterName$, PortName$
  95.  
  96. DriverName = DrvName.Text + Chr$(0)
  97. PrinterName = PrtName.Text + Chr$(0)
  98. PortName = PtName.Text + Chr$(0)
  99.  
  100. 'Unfortunately VB does not support the DEVMODE structure
  101. 'very well or we could have used the common dialog box to
  102. 'get this information
  103.  
  104. If PESelectPrinter(JobNum, DriverName, PrinterName, PortName, 0) = False Then
  105.     RCode = GetErrorString(JobNum)
  106.     MsgBox "PESelectPrinter Error #: " + Str(ErrorCode) + " - " + RCode
  107. Else
  108.     PrintFrm.SelectedPrinter.Caption = Left$(PrinterName, Len(PrinterName) - 1) & " on " & Left$(PortName, Len(PortName) - 1)
  109. End If
  110.  
  111. Unload Me
  112.  
  113. End Sub
  114.  
  115. Sub Command2_Click ()
  116.  
  117. Unload Me
  118.  
  119. End Sub
  120.  
  121. Sub Command3_Click ()
  122.  RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  123. End Sub
  124.  
  125.