home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form Form1 Caption = "VB General Printer" ClientHeight = 4665 ClientLeft = 1170 ClientTop = 1710 ClientWidth = 7365 Height = 5355 Icon = VBG1.FRX:0000 Left = 1110 LinkTopic = "Form1" ScaleHeight = 4665 ScaleWidth = 7365 Top = 1080 Width = 7485 Begin CheckBox chkItalic Caption = "Italic" Height = 375 Left = 3000 TabIndex = 10 Top = 1800 Width = 1455 End Begin CheckBox chkBold Caption = "Bold" Height = 375 Left = 960 TabIndex = 9 Top = 1800 Width = 1215 End Begin ComboBox Combo2 Height = 300 Left = 5280 TabIndex = 8 Text = "Combo2" Top = 1320 Width = 1575 End Begin ComboBox Combo1 Height = 300 Left = 720 TabIndex = 7 Text = "Combo1" Top = 1320 Width = 3255 End Begin CommandButton cmdExit Caption = "E&xit" Height = 375 Left = 4320 TabIndex = 0 Top = 4080 Width = 1695 End Begin CommandButton cmdPrint Caption = "&Print" Height = 375 Left = 1440 TabIndex = 4 Top = 4080 Width = 1695 End Begin TextBox Text1 Height = 1455 Left = 120 MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 3 Text = "Text1" Top = 2400 Width = 7095 End Begin Frame Frame1 Caption = "Instructions:" Height = 1095 Left = 120 TabIndex = 1 Top = 120 Width = 7095 Begin Label Label1 Caption = "Enter text in the box below. Choose File|Print to print text or click on command button below. Choose File|Printer Select... to choose new printer." Height = 735 Left = 120 TabIndex = 2 Top = 240 Width = 6855 End End Begin Label Label3 Caption = "Font Size:" Height = 375 Left = 4200 TabIndex = 6 Top = 1320 Width = 1215 End Begin Label Label2 Caption = "Font:" Height = 375 Left = 120 TabIndex = 5 Top = 1320 Width = 735 End Begin Menu mnuFile Caption = "&File" Begin Menu mnuPrinterSelect Caption = "Printer &Select..." End Begin Menu mnuPrint Caption = "&Print" End Begin Menu mnuSep1 Caption = "-" End Begin Menu mnuExit Caption = "E&xit" End End Begin Menu mnuHelp Caption = "&Help" Begin Menu mnuAbout Caption = "&About VBGPRINT" End End '---------------------------------------------------------------- 'Copyright 1994 Unger Business Systems All Rights Reserved 'This code is distributed as shareware. If you use it, you 'are required by law to register it. Please contact Unger 'Business Systems at 11926 Barrett Brae, Houston, TX 77072-4004 'or call (713) 498-8517. Registration fee is $20.00 US 'See the README.TXT file for more information 'All code, forms, modules, controls, etc. are provided without 'warranty or liability '---------------------------------------------------------------- Option Explicit Dim UseBold%, UseItalic% Sub cmdExit_Click () mnuExit_Click End Sub Sub cmdPrint_Click () mnuPrint_Click End Sub Sub Combo1_Click () Dim Pos%, TStr$ 'if chosen font has BOLD or ITALIC in its name, set the 'appropriate check box TStr = UCase$(Combo1.Text) Pos = InStr(1, TStr, "BOLD") If Pos > 0 Then chkBold = 1 Else chkBold = 0 End If Pos = InStr(1, TStr, "ITALIC") If Pos > 0 Then chkItalic = 1 Else chkItalic = 0 End If End Sub Sub FillCombo1 () 'This routine reads all of the installed fonts and 'stores them as choices in the combo box Dim InstalledFonts$, OldPos%, Counter%, Pos%, I% Dim IPos%, ThisFont$ InstalledFonts = Space$(4096) 'Calling GetProfileString with 0& as the second parameter returns a list 'of all items in the "fonts" section of WIN.INI 'These are separated by ASCII 0's and must be parsed I% = GetProfileString("fonts", 0&, "none", InstalledFonts, Len(InstalledFonts)) InstalledFonts = Left$(InstalledFonts, I%) If InstalledFonts = "none" Then MsgBox "No Windows fonts installed.", MB_ICONSTOP Exit Sub End If OldPos% = 1 Counter = 1 Do While 1 IPos% = InStr(OldPos%, InstalledFonts, Chr$(0)) If IPos% > 0 Then ThisFont = Mid$(InstalledFonts, OldPos%, IPos% - OldPos%) Combo1.AddItem ThisFont OldPos% = IPos% + 1 Else Exit Do End If Loop Combo1.ListIndex = 0 End Sub Sub FillCombo2 () Combo2.Clear Combo2.AddItem "6" Combo2.AddItem "8" Combo2.AddItem "10" Combo2.AddItem "12" Combo2.AddItem "14" Combo2.AddItem "18" Combo2.AddItem "24" Combo2.AddItem "36" Combo2.AddItem "48" Combo2.ListIndex = 2 End Sub Sub Form_Load () CRLF = Chr$(13) & Chr$(10) Text1 = "" 'Get the default windows printer for a starting point ThisPrinter = GetWindowsDefaultPrinter() ThisOrientation = GetWindowsPrinterOrientation(ThisPrinter) FillCombo1 'available fonts FillCombo2 'some font sizes End Sub Sub Form_Unload (Cancel As Integer) End End Sub Sub mnuAbout_Click () frmAbout.Show 1 'modal End Sub Sub mnuExit_Click () Unload Me End Sub Sub mnuPrint_Click () PrintThisText Text1, Combo1.Text, Val(Combo2.Text), UseBold, UseItalic End Sub Sub mnuPrinterSelect_Click () SelectPrinter ThisPrinter, ThisOrientation, "VBG Printer" End Sub