home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / crpedemo / winfrm.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1994-12-15  |  7.8 KB  |  233 lines

  1. VERSION 2.00
  2. Begin Form WinFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Print To Window"
  5.    ClientHeight    =   2520
  6.    ClientLeft      =   1980
  7.    ClientTop       =   2580
  8.    ClientWidth     =   5520
  9.    Height          =   2925
  10.    Left            =   1920
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2520
  15.    ScaleWidth      =   5520
  16.    Top             =   2235
  17.    Width           =   5640
  18.    Begin CommandButton Command1 
  19.       Caption         =   "Help"
  20.       Height          =   375
  21.       Left            =   3600
  22.       TabIndex        =   8
  23.       Top             =   1920
  24.       Width           =   1185
  25.    End
  26.    Begin SSCheck SavedData 
  27.       Caption         =   "Use Saved Data"
  28.       Enabled         =   0   'False
  29.       Font3D          =   0  'None
  30.       Height          =   255
  31.       Left            =   2400
  32.       TabIndex        =   3
  33.       Top             =   730
  34.       Width           =   1815
  35.    End
  36.    Begin SSCheck ShowControls 
  37.       Caption         =   "Show Print Controls"
  38.       Font3D          =   0  'None
  39.       Height          =   225
  40.       Left            =   1680
  41.       TabIndex        =   4
  42.       Top             =   1440
  43.       Value           =   -1  'True
  44.       Width           =   2055
  45.    End
  46.    Begin CommandButton Command3 
  47.       Cancel          =   -1  'True
  48.       Caption         =   "Cancel"
  49.       Height          =   375
  50.       Left            =   2220
  51.       TabIndex        =   7
  52.       Top             =   1920
  53.       Width           =   1215
  54.    End
  55.    Begin CommandButton Command2 
  56.       Caption         =   "Print"
  57.       Default         =   -1  'True
  58.       Height          =   375
  59.       Left            =   840
  60.       TabIndex        =   5
  61.       Top             =   1920
  62.       Width           =   1215
  63.    End
  64.    Begin SSFrame Frame3D1 
  65.       Font3D          =   0  'None
  66.       ForeColor       =   &H00000000&
  67.       Height          =   1215
  68.       Left            =   120
  69.       TabIndex        =   10
  70.       Top             =   0
  71.       Width           =   5295
  72.       Begin TextBox NDetailCopies 
  73.          Height          =   285
  74.          Left            =   4560
  75.          TabIndex        =   11
  76.          Top             =   240
  77.          Width           =   615
  78.       End
  79.       Begin TextBox StartPage 
  80.          Height          =   285
  81.          Left            =   1440
  82.          TabIndex        =   0
  83.          Top             =   240
  84.          Width           =   615
  85.       End
  86.       Begin TextBox EndPage 
  87.          Height          =   285
  88.          Left            =   1440
  89.          TabIndex        =   1
  90.          Top             =   720
  91.          Width           =   615
  92.       End
  93.       Begin Label Label3 
  94.          BackColor       =   &H00C0C0C0&
  95.          Caption         =   "Number of Detail Copies:"
  96.          Height          =   255
  97.          Left            =   2280
  98.          TabIndex        =   2
  99.          Top             =   285
  100.          Width           =   2175
  101.       End
  102.       Begin Label Label5 
  103.          BackColor       =   &H00C0C0C0&
  104.          Caption         =   "Starting Page:"
  105.          Height          =   255
  106.          Left            =   120
  107.          TabIndex        =   6
  108.          Top             =   285
  109.          Width           =   1335
  110.       End
  111.       Begin Label Label6 
  112.          BackColor       =   &H00C0C0C0&
  113.          Caption         =   "Ending Page:"
  114.          Height          =   255
  115.          Left            =   120
  116.          TabIndex        =   9
  117.          Top             =   765
  118.          Width           =   1215
  119.       End
  120.    End
  121. Sub Command1_Click ()
  122.    RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  123. End Sub
  124. Sub Command2_Click ()
  125.     Dim Options As PEPrintOptions
  126.     Dim C As New Child
  127.     If PESetNDetailCopies(JobNum, Val(NDetailCopies.Text)) = False Then
  128.         RCode = GetErrorString(JobNum)
  129.         MsgBox "PESetNDetailCopies Error #: " + Str(ErrorCode) + " - " + RCode
  130.         Exit Sub
  131.     End If
  132.     Options.StructSize = Len(Options)
  133.     Options.NReportCopies = 0
  134.     Options.StartPageN = Val(StartPage.Text)
  135.     Options.stopPageN = Val(EndPage.Text)
  136.     If PESetPrintOptions(JobNum, Options) = False Then
  137.         RCode = GetErrorString(JobNum)
  138.         MsgBox "PESetPrintOptions Error #: " + Str(ErrorCode) + " - " + RCode
  139.         Exit Sub
  140.     End If
  141.     If PEShowPrintControls(JobNum, ShowControls.Value) = False Then
  142.         RCode = GetErrorString(JobNum)
  143.         MsgBox "PEShowPrintControls Error #: " + Str(ErrorCode) + " - " + RCode
  144.         Exit Sub
  145.     End If
  146.     If ShowControls.Value = False Then
  147.         Main.Command3D13.Visible = True
  148.         Main.Command3D14.Visible = True
  149.         Main.Command3D15.Visible = True
  150.         Main.Command3D16.Visible = True
  151.         Main.Command3D17.Visible = True
  152.         Main.Panel3D1.Visible = True
  153.     Else
  154.         Main.Command3D13.Visible = False
  155.         Main.Command3D14.Visible = False
  156.         Main.Command3D15.Visible = False
  157.         Main.Command3D16.Visible = False
  158.         Main.Command3D17.Visible = False
  159.         Main.Panel3D1.Visible = False
  160.     End If
  161.         
  162.     C.Caption = "MDIChild-CRPEDemo"
  163.      'Set the border style of the print window so that it has no border,max or min
  164.      'buttons, control box etc.
  165.      'Border_style% = 268435456
  166.      'Send the Print job to be printed to a window
  167.     If PEOutPutToWindow(JobNum, C.Caption, ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight, 268435456, C.hWnd) = False Then
  168.         RCode = GetErrorString(JobNum)
  169.         MsgBox "PEOutputToWindow Error #: " + Str(ErrorCode) + " - " + RCode
  170.         Exit Sub
  171.      End If
  172.     If SavedData.Enabled = True And SavedData.Value = False Then
  173.         If PEDiscardSavedData(JobNum) = False Then
  174.             RCode = GetErrorString(JobNum)
  175.             MsgBox "PEStartPrintJob Error #: " + Str(ErrorCode) + " - " + RCode
  176.             Exit Sub
  177.         End If
  178.     End If
  179.     Unload Me
  180.      FreeRes = FreeResourcesAreAbove(20)
  181.      If FreeRes = False Then
  182.        MsgBox "Your System Resources are below 20% Free, the job cannot be started! Please exit CRPEDemo, close some of your other Windows applications and try again."
  183.        Exit Sub
  184.      End If
  185.      
  186.      'Cascade the print window by default prior to calling
  187.      'start print job
  188.      Main.Arrange Cascade
  189.      If PEStartPrintJob(JobNum, True) = False Then
  190.       RCode = GetErrorString(JobNum)
  191.       Unload C
  192.       MsgBox "PEStartPrintJob Error #: " + Str(ErrorCode) + " - " + RCode
  193.       Exit Sub
  194.      Else
  195.        Main!StatusBar.Caption = "Preview to window Successful."
  196.      End If
  197.      'Main.Arrange Cascade
  198. End Sub
  199. Sub Command3_Click ()
  200. Unload Me
  201. End Sub
  202. Sub Form_Load ()
  203.     Dim DetailCopies%, ReportCopies%
  204.     Dim Options As PEPrintOptions
  205.     Dim UseSavedData%
  206.     If PEGetNDetailCopies(JobNum, DetailCopies) = False Then
  207.         RCode = GetErrorString(JobNum)
  208.         MsgBox "PEGetNDetailCopies Error #: " + Str(ErrorCode) + " - " + RCode
  209.         Exit Sub
  210.     End If
  211.     NDetailCopies.Text = DetailCopies
  212.     Options.StructSize = Len(Options)
  213.     If PEGetPrintOptions(JobNum, Options) = False Then
  214.         RCode = GetErrorString(JobNum)
  215.         MsgBox "PEGetPrintOptions Error #: " + Str(ErrorCode) + " - " + RCode
  216.         Exit Sub
  217.     End If
  218.     StartPage.Text = ""
  219.     EndPage.Text = ""
  220.     If PEHasSavedData(JobNum, UseSavedData) = False Then
  221.         RCode = GetErrorString(JobNum)
  222.         MsgBox "PEHasSavedData Error #: " + Str(ErrorCode) + " - " + RCode
  223.         Exit Sub
  224.     End If
  225.     If UseSavedData = 1 Then
  226.         SavedData.Enabled = True
  227.         SavedData.Value = True
  228.     Else
  229.         SavedData.Enabled = False
  230.         SavedData.Value = False
  231.     End If
  232. End Sub
  233.