home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form PrintDlgForm
- BorderStyle = 3 'Fixed Dialog
- Caption = "Print example"
- ClientHeight = 6825
- ClientLeft = 390
- ClientTop = 330
- ClientWidth = 6930
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6825
- ScaleWidth = 6930
- ShowInTaskbar = 0 'False
- Begin VB.Frame Frame7
- Caption = "Other Options"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1575
- Left = 120
- TabIndex = 36
- Top = 4560
- Width = 6735
- Begin VB.CheckBox PrinterDefaultCheck
- Caption = "PrinterDefault"
- Height = 285
- Left = 4440
- TabIndex = 25
- Top = 270
- Width = 1605
- End
- Begin VB.TextBox MinPageText
- Height = 285
- Left = 1320
- TabIndex = 29
- Top = 1200
- Width = 615
- End
- Begin VB.TextBox MaxPageText
- Height = 285
- Left = 2640
- TabIndex = 30
- Top = 1200
- Width = 615
- End
- Begin VB.TextBox ToPageText
- Height = 285
- Left = 2640
- TabIndex = 28
- Top = 720
- Width = 615
- End
- Begin VB.TextBox FromPageText
- Height = 285
- Left = 1320
- TabIndex = 27
- Top = 720
- Width = 615
- End
- Begin VB.TextBox NumOfCopiesText
- Height = 285
- Left = 5850
- TabIndex = 31
- Top = 1200
- Width = 735
- End
- Begin VB.CheckBox RaiseEventCheck
- Caption = "Raise Callback &Event"
- Height = 285
- Left = 4440
- TabIndex = 26
- Top = 720
- Width = 1875
- End
- Begin VB.TextBox PrintCaptionText
- Height = 315
- Left = 1710
- TabIndex = 24
- Text = "Custom Print"
- Top = 240
- Width = 2385
- End
- Begin VB.Label Label11
- AutoSize = -1 'True
- Caption = "from:"
- Height = 195
- Left = 840
- TabIndex = 43
- Top = 1230
- Width = 345
- End
- Begin VB.Label Label5
- AutoSize = -1 'True
- Caption = "from:"
- Height = 195
- Left = 840
- TabIndex = 42
- Top = 750
- Width = 345
- End
- Begin VB.Label Label9
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Min"
- Height = 195
- Index = 1
- Left = 240
- TabIndex = 41
- Top = 1230
- Width = 255
- End
- Begin VB.Label Label10
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Max to:"
- Height = 195
- Index = 1
- Left = 2040
- TabIndex = 40
- Top = 1230
- Width = 525
- End
- Begin VB.Label Label10
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "to:"
- Height = 195
- Index = 0
- Left = 2400
- TabIndex = 39
- Top = 750
- Width = 180
- End
- Begin VB.Label Label9
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- Caption = "Pages"
- Height = 195
- Index = 0
- Left = 240
- TabIndex = 38
- Top = 750
- Width = 450
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- Caption = "Number of Copies"
- Height = 195
- Left = 4440
- TabIndex = 37
- Top = 1230
- Width = 1260
- End
- Begin VB.Label Label4
- Caption = "Print Di&alog Caption"
- Height = 255
- Left = 240
- TabIndex = 23
- Top = 285
- Width = 1515
- End
- End
- Begin VB.Frame Frame5
- Caption = "Help Options"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1455
- Index = 1
- Left = 120
- TabIndex = 35
- Top = 3060
- Width = 6735
- Begin VB.OptionButton HelpContextOpt
- Caption = "Help Co&ntext"
- Height = 255
- Left = 180
- TabIndex = 17
- Top = 690
- Value = -1 'True
- Width = 1245
- End
- Begin VB.TextBox HelpFileText
- Height = 315
- Left = 1410
- TabIndex = 15
- Top = 210
- Width = 4005
- End
- Begin VB.OptionButton HelpKeyOpt
- Caption = "Help &Key"
- Height = 255
- Left = 180
- TabIndex = 20
- Top = 1080
- Width = 1245
- End
- Begin VB.TextBox HelpContextNumberText
- Height = 315
- Left = 2880
- TabIndex = 19
- Top = 630
- Width = 1005
- End
- Begin VB.TextBox HelpKeyText
- Height = 315
- Left = 2880
- TabIndex = 22
- Top = 1050
- Width = 1005
- End
- Begin VB.CommandButton Command1
- Caption = "&Browse..."
- Height = 375
- Left = 5520
- TabIndex = 16
- Top = 200
- Width = 1095
- End
- Begin VB.Label Label6
- Caption = "&Help File Name"
- Height = 255
- Left = 180
- TabIndex = 14
- Top = 270
- Width = 1155
- End
- Begin VB.Label Label7
- Caption = "Context Number"
- Height = 255
- Left = 1620
- TabIndex = 18
- Top = 690
- Width = 1155
- End
- Begin VB.Label Label8
- Caption = "Help Key Word"
- Height = 255
- Left = 1620
- TabIndex = 21
- Top = 1110
- Width = 1155
- End
- End
- Begin VB.Frame Frame4
- Caption = "OK and Cancel Button Options"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1455
- Left = 120
- TabIndex = 34
- Top = 120
- Width = 4215
- Begin VB.CheckBox CancelErrorCheck
- Caption = "&Raise Error On Cancel"
- Height = 285
- Left = 2160
- TabIndex = 1
- Top = 240
- Width = 1905
- End
- Begin VB.CheckBox HideCancelCheck
- Caption = "Hide Cancel B&utton"
- Height = 285
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 1845
- End
- Begin VB.CheckBox CustomButtonCaptionCheck
- Caption = "Change &OK Button Caption"
- Height = 285
- Left = 120
- TabIndex = 2
- Top = 660
- Width = 2865
- End
- Begin VB.TextBox CustomButtonCaptionText
- Height = 345
- Left = 3060
- TabIndex = 3
- Text = "&Select"
- Top = 630
- Width = 945
- End
- Begin VB.TextBox CustomCancelCaptionText
- Height = 345
- Left = 3060
- TabIndex = 5
- Text = "E&xit"
- Top = 1050
- Width = 945
- End
- Begin VB.CheckBox CustomCancelCaptionCheck
- Caption = "Change &Cancel Button Caption"
- Height = 285
- Left = 120
- TabIndex = 4
- Top = 1080
- Width = 2865
- End
- End
- Begin VB.Frame Frame3
- Caption = "Dialog Box Position"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1440
- Left = 120
- TabIndex = 33
- Top = 1600
- Width = 4215
- Begin VB.CheckBox SetDlgPosCheck
- Caption = "Set &Dialog Position"
- Height = 285
- Left = 120
- TabIndex = 6
- Top = 240
- Width = 1845
- End
- Begin VB.CheckBox SetDlgPosToScreenCheck
- Caption = "Set Dialog &Position Relative To Screen"
- Height = 285
- Left = 360
- TabIndex = 7
- Top = 630
- Width = 3075
- End
- Begin VB.TextBox XPosText
- Height = 345
- Left = 1380
- TabIndex = 9
- Text = "0"
- Top = 990
- Width = 555
- End
- Begin VB.TextBox YPosText
- Height = 345
- Left = 2880
- TabIndex = 11
- Text = "0"
- Top = 990
- Width = 555
- End
- Begin VB.Label Label1
- Caption = "&X Position"
- Height = 225
- Left = 540
- TabIndex = 8
- Top = 1050
- Width = 765
- End
- Begin VB.Label Label2
- Caption = "&Y Position"
- Height = 225
- Left = 2040
- TabIndex = 10
- Top = 1050
- Width = 735
- End
- End
- Begin VB.Frame Frame2
- Caption = "&Flags"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2940
- Left = 4440
- TabIndex = 12
- Top = 120
- Width = 2415
- Begin VB.ListBox List1
- Height = 2205
- ItemData = "print.frx":0000
- Left = 120
- List = "print.frx":0046
- MultiSelect = 1 'Simple
- TabIndex = 13
- Top = 240
- Width = 2175
- End
- End
- Begin VB.CommandButton ShowPrintBut
- Caption = "&Show Dialog!"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 13.5
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 525
- Left = 4560
- TabIndex = 32
- Top = 6240
- Width = 2325
- End
- Attribute VB_Name = "PrintDlgForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim WithEvents dwCmdDialog As dwPrint
- Attribute dwCmdDialog.VB_VarHelpID = -1
- Private Sub command1_Click()
- Dim dwCmdDialog As dwFileOpenSave
- Dim lres As Long
- Dim lstr As String
- Set dwCmdDialog = New dwFileOpenSave
- dwCmdDialog.DialogTitle = "Select Help File"
- dwCmdDialog.Filter = "Help (*.hlp)|*.hlp|All Files (*.*)|*.*"
- dwCmdDialog.DlgWindowOwner = Me.hWnd
- dwCmdDialog.SetDialogPosition = True
- dwCmdDialog.PosX = 50
- dwCmdDialog.PosY = 50
- dwCmdDialog.CustomOkButtonCaption = True
- dwCmdDialog.OkButtonCaption = "Select"
- dwCmdDialog.Flags = glmcdOFNEnableHook Or glmcdOFNLongNames Or glmcdOFNFileMustexist Or glmcdOFNNoChangeDir Or glmcdOFNHideReadOnly
- If WindowsVersion <> 35 Then
- dwCmdDialog.Flags = dwCmdDialog.Flags Or glmcdOFNExplorer
- End If
- lres = dwCmdDialog.ShowOpen
- If lres = 1 Then
- HelpFileText.Text = dwCmdDialog.filename
- End If
- Set dwCmdDialog = Nothing
- End Sub
- Private Sub Form_Load()
- If SetDlgPosCheck.Value Then
- SetDlgPosToScreenCheck.Enabled = True
- XPosText.Enabled = True
- YPosText.Enabled = True
- Else
- SetDlgPosToScreenCheck.Enabled = False
- XPosText.Enabled = False
- YPosText.Enabled = False
- End If
- ' Initialize list box
- List1.Selected(4) = True ' collate
- List1.Selected(11) = True ' show help button
- List1.Selected(12) = True ' enable hook
- End Sub
- Private Sub HelpContextOpt_Click()
- HelpContextNumberText.Enabled = True
- HelpKeyText.Enabled = False
- HelpKeyText.Text = ""
- End Sub
- Private Sub HelpKeyOpt_Click()
- HelpKeyText.Enabled = True
- HelpContextNumberText.Enabled = False
- HelpContextNumberText.Text = ""
- End Sub
- Private Sub OpenSaveCaptionText_Change()
- End Sub
- Private Sub SetDlgPosCheck_Click()
- If SetDlgPosCheck.Value Then
- SetDlgPosToScreenCheck.Enabled = True
- XPosText.Enabled = True
- YPosText.Enabled = True
- Else
- SetDlgPosToScreenCheck.Enabled = False
- XPosText.Enabled = False
- YPosText.Enabled = False
- End If
- End Sub
- Private Function GetPrintFlags() As Long
- Dim lcount As Long, lindex As Long
- Dim flagvalue As Long
- lindex = List1.ListCount
- For lcount = 0 To lindex - 1 Step 1
- If List1.Selected(lcount) Then
- flagvalue = flagvalue + 2 ^ lcount
- End If
- Next
- GetPrintFlags = flagvalue
- End Function
- Private Sub ShowPrintBut_Click()
- Dim lres As Long
- Dim lstr As String
- On Error GoTo printererror
- Set dwCmdDialog = New dwPrint
- dwCmdDialog.DialogTitle = PrintCaptionText.Text
- dwCmdDialog.DlgWindowOwner = Me.hWnd
- dwCmdDialog.HideCancel = HideCancelCheck.Value
- dwCmdDialog.SetDialogPosition = SetDlgPosCheck.Value
- dwCmdDialog.SetDialogRelativeToScreen = SetDlgPosToScreenCheck.Value
- dwCmdDialog.PosX = Val(XPosText.Text)
- dwCmdDialog.PosY = Val(YPosText.Text)
- dwCmdDialog.CustomOkButtonCaption = CustomButtonCaptionCheck.Value
- dwCmdDialog.OkButtonCaption = CustomButtonCaptionText.Text
- dwCmdDialog.CustomCancelButtonCaption = CustomCancelCaptionCheck.Value
- dwCmdDialog.CancelButtonCaption = CustomCancelCaptionText.Text
- dwCmdDialog.Flags = GetPrintFlags()
- dwCmdDialog.PrinterDefault = PrinterDefaultCheck.Value
- dwCmdDialog.RaiseCallbackEvent = RaiseEventCheck.Value
- dwCmdDialog.CancelError = CancelErrorCheck.Value
- dwCmdDialog.HelpFile = Trim$(HelpFileText.Text)
- If dwCmdDialog.HelpFile <> "" Then
- If HelpContextOpt.Value Then
- dwCmdDialog.HelpCommand = glmcdHCContext
- dwCmdDialog.HelpContext = Val(HelpContextNumberText.Text)
- Else
- dwCmdDialog.HelpCommand = glmcdHCKey
- dwCmdDialog.HelpKey = HelpKeyText.Text
- End If
- End If
- If Trim$(FromPageText.Text) <> "" Then
- dwCmdDialog.FromPage = Val(FromPageText.Text)
- End If
- If Trim$(ToPageText.Text) <> "" Then
- dwCmdDialog.ToPage = Val(ToPageText.Text)
- End If
- If Trim$(MinPageText.Text) <> "" Then
- dwCmdDialog.Min = Val(MinPageText.Text)
- End If
- If Trim$(MaxPageText.Text) <> "" Then
- dwCmdDialog.Max = Val(MaxPageText.Text)
- End If
- If Trim$(NumOfCopiesText.Text) <> "" Then
- dwCmdDialog.Copies = Val(NumOfCopiesText.Text)
- End If
- lres = dwCmdDialog.ShowPrinter
- If lres = 1 Then
- FromPageText.Text = dwCmdDialog.FromPage
- ToPageText.Text = dwCmdDialog.ToPage
- NumOfCopiesText.Text = dwCmdDialog.Copies
- End If
- Set dwCmdDialog = Nothing
- Exit Sub
- printererror:
- Debug.Print "Error occurred " & Err.Number & ", " & Err.Description
- Set dwCmdDialog = Nothing
- End Sub
-