home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
code
/
print
/
vbbook13
/
vbbinp13.frm
< prev
next >
Wrap
Text File
|
1995-02-26
|
31KB
|
886 lines
VERSION 2.00
Begin Form VBBinp
BackColor = &H00FF8080&
Caption = "VB Book Input"
ClientHeight = 5595
ClientLeft = 1260
ClientTop = 1545
ClientWidth = 5640
Height = 6120
Icon = VBBINP13.FRX:0000
Left = 1200
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 5595
ScaleWidth = 5640
Top = 1080
Width = 5760
Begin Frame Outname
BackColor = &H008080FF&
Caption = "Output To:"
Height = 855
Left = 3180
TabIndex = 11
Top = 4560
Width = 2235
Begin ComboBox comboutname
BackColor = &H00C0C0C0&
Height = 300
Left = 60
TabIndex = 8
Top = 360
Width = 2115
End
End
Begin DirListBox Dir1
BackColor = &H00C0C0C0&
Height = 2535
Left = 240
TabIndex = 6
Top = 2880
Width = 2895
End
Begin FileListBox File1
BackColor = &H00C0C0C0&
Height = 1980
Left = 3720
TabIndex = 7
Top = 2520
Width = 1695
End
Begin DriveListBox Drive1
BackColor = &H00C0C0C0&
Height = 315
Left = 240
TabIndex = 5
Top = 2520
Width = 2895
End
Begin CheckBox Clk6
Caption = "A2 (American) Paper or A4 if off"
Height = 255
Left = 360
TabIndex = 15
Top = 2040
Value = 1 'Checked
Width = 3255
End
Begin ComboBox Linelength
BackColor = &H00C0C0C0&
Height = 300
Left = 4260
TabIndex = 13
Top = 1740
Width = 1035
End
Begin CheckBox clk5
Caption = "Set Line Wrap On"
Height = 255
Left = 360
TabIndex = 4
Top = 1680
Value = 1 'Checked
Width = 3255
End
Begin TextBox Text1
BackColor = &H00FF8080&
BorderStyle = 0 'None
Enabled = 0 'False
Height = 195
Left = 4260
MultiLine = -1 'True
TabIndex = 14
Text = "Text Width:"
Top = 1500
Width = 1035
End
Begin CheckBox clk4
Caption = "Use Speaker"
Height = 255
Left = 360
TabIndex = 3
Top = 1320
Value = 1 'Checked
Width = 3255
End
Begin CheckBox clk3
Caption = "Print Page Numbers"
Height = 255
Left = 360
TabIndex = 2
Top = 960
Value = 1 'Checked
Width = 3255
End
Begin PictureBox Picture1
BackColor = &H00FF8080&
Height = 495
Left = 4500
Picture = VBBINP13.FRX:0302
ScaleHeight = 465
ScaleWidth = 465
TabIndex = 12
Top = 660
Width = 495
End
Begin CheckBox clk2
Caption = "Print Date/Time on each Page"
Height = 255
Left = 360
TabIndex = 1
Top = 600
Value = 1 'Checked
Width = 3255
End
Begin CommandButton go
Caption = "Do It"
Default = -1 'True
Height = 375
Left = 4800
TabIndex = 9
Top = 240
Width = 735
End
Begin CommandButton Cancel
Caption = "Cancel"
Height = 375
Left = 3960
TabIndex = 10
Top = 240
Width = 735
End
Begin CheckBox clk1
BackColor = &H00FFFFFF&
Caption = "Print Filename on each Page"
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 0
Top = 240
Value = 1 'Checked
Width = 3255
End
End
Dim ESC$, FF$, LF$, FileName$, outfile$, NewName$, NL$
Dim Page%, num$, tune%
Dim PC As Flags
Dim PaperAmerican
Dim PaperWidth
Dim ToAFile
Dim LeftSide%, RightSide%, FirstPass%
Dim Bookmark%, Junk%, Abort%
Dim Default$, Title$, Msg$
Dim lastchange As Integer
Const fileboxclick = 0, dirsboxclick = 1
'Const True = -1, False = 0
Sub BuildArray (ptrarray&(), pgcount%)
'Was Satic Sub ...
MaxLines% = 66 'Maximum number of lines
Offset& = 1 'Start of file (seek point)
Open FileName$ For Binary Access Read As #1 Len = 1 'Open file to check
TotalSize& = LOF(1) 'Get LEN of file so we don't read too far
FileLeft& = TotalSize& 'Setup a counter to show whats left
'FRE is not supported by VB. Use GetFreeSpace() instead (see global module)
memAvail& = GetFreeSpace(0) '65536 FRE(FileName$) - 2048 'Check available string memory
If memAvail& < 2048 Then Error 14 'Force out of memory error
SixteenK% = 16384
If TotalSize& > SixteenK% Then 'Set a buffer size
If memAvail& > SixteenK% Then 'If the file is larger than 16K
BufAvail& = SixteenK% 'Set it to 16k
Else
BufAvail& = memAvail&
End If
Else
If TotalSize& < memAvail& Then 'Otherwise set it to file size
BufAvail& = TotalSize&
End If
BuffSize% = BufAvail&
End If
pgcount% = 1 'Initialize page count
ptrarray&(pgcount%) = 1 'First pointer is always 1
LnCount% = 0 'Initialize line count
GetPage: 'Read the file
If FileLeft& < BufAvail& Then 'Check amount left to read
Buffer$ = Space$(FileLeft&) 'If less than our buffer, use lessor
Else
Buffer$ = Space$(BufAvail&) 'Otherwise use full buffer size
End If
Get #1, Offset&, Buffer$ 'Read in a buffers worth
stptr% = 1 'Pointer into buffer$
LastLine% = 0 'remember last position
PageCheck:
Junk% = DoEvents() 'yield some time to the system
TempLn% = InStr(stptr%, Buffer$, LF$) 'Position of next linefeed
temppg% = InStr(stptr%, Buffer$, FF$) 'Position of next pagefeeds
If temppg% Then 'If there was a page feed
If temppg% < TempLn% Or TempLn% = 0 Then ' was it before our linefeed?
pgcount% = pgcount% + 1 ' yes then bump page count
ptrarray&(pgcount%) = Offset& + temppg% ' set next array element
stptr% = temppg% + 1 ' set instr pointer
LnCount% = 0 ' reset linecount
If stptr% < Len(Buffer$) Then GoTo PageCheck 'and loop back for more
End If
End If
If TempLn% Then 'Linefeed
If PC.LineWrap Then 'If Line Wrap, check length
If TempLn% - stptr% > PC.Linelen Then 'Greater than 80?
Do 'check for line wrap
LnCount% = LnCount% + 1 'increment line
If LnCount% = MaxLines% Then
GoTo PageBreak '> 66 lines
End If
stptr% = stptr% + PC.Linelen
Loop While TempLn% - stptr% > PC.Linelen
End If
End If
LnCount% = LnCount% + 1 'Increment page count
PageBreak:
If LnCount% = MaxLines% Then
pgcount% = pgcount% + 1
If pgcount% > 512 Then
Msg$ = "Too may pages - printing only 512."
MsgBox Msg$, 0, "Notice"
GoTo EndBuild
End If
ptrarray&(pgcount%) = Offset& + TempLn% 'point to next point in file
LnCount% = 0
End If
stptr% = TempLn% + 1 'point ahead 1 byte for next scan
If stptr% <= Len(Buffer$) Then
GoTo PageCheck 'keep checking
End If
End If
Offset& = Offset& + Len(Buffer$) 'Pointer into file (tally)
stptr% = 1 'Reset Buffer pointer
FileLeft& = TotalSize& - Offset& 'Calculate how much is left
If Offset& < TotalSize& Then GoTo GetPage 'If more text in file, keep going
EndBuild:
ptrarray&(pgcount% + 1) = TotalSize& 'Set last pointer to end of file
Close #1 'Close input file
End Sub 'End of BuildArray Sub
Sub Cancel_Click ()
'If user clicks on the cancel button then ...
Close
End
End Sub
Sub clk1_Click ()
'Toggle on/off
If PC.FileTitle = 0 Then
PC.FileTitle = -1
PC.DoHeader = -1
Else
PC.FileTitle = 0
'Still have to do the Header if clk2 or clk3 buttons are checked
If (clk2.Value = -1) Or (clk3.Value = -1) Then
PC.DoHeader = -1
Else
PC.DoHeader = 0
End If
End If
End Sub
Sub clk2_Click ()
'Toggle on/off
If PC.CurDate = 0 Then
PC.CurDate = -1
PC.DoHeader = -1
Else
PC.CurDate = 0
'Still have to do the Header if clk1 or clk3 buttons are checked
If (clk1.Value = -1) Or (clk3.Value = -1) Then
PC.DoHeader = -1
Else
PC.DoHeader = 0
End If
End If
End Sub
Sub clk3_Click ()
'Toggle on/off
If PC.PgNumber = 0 Then
PC.PgNumber = -1
PC.DoHeader = -1
Else
PC.PgNumber = 0
'Still have to do the Header if clk1 or clk2 buttons are checked
If (clk1.Value = -1) Or (clk2.Value = -1) Then
PC.DoHeader = -1
Else
PC.DoHeader = 0
End If
End If
End Sub
Sub clk4_Click ()
'Toggle on/off
tune% = Not tune%
End Sub
Sub clk5_Click ()
'Toggle on/off
PC.LineWrap = Not PC.LineWrap
End Sub
Sub Clk6_Click ()
If PaperAmerican = True Then 'if true, changing to A4
PaperAmerican = False
PaperWidth = 185 'A4 (British) paper width
PC.tempmrg = 100 'right side left margin of
'PC.tempmrg = 90 'right side left margin of
Do While linelength.ListCount
linelength.RemoveItem 0
Loop
linelength.AddItem "65"
linelength.AddItem "70"
linelength.AddItem "75"
linelength.AddItem "80"
linelength.AddItem "85"
linelength.AddItem "90"
linelength.Text = linelength.List(5)
Else
PaperAmerican = True 'A2 (American) paper
PaperWidth = 175
PC.tempmrg = 95 'right side left margin of 95
'linelength.text = "80"
Do While linelength.ListCount
linelength.RemoveItem 0
Loop
linelength.AddItem "65"
linelength.AddItem "70"
linelength.AddItem "75"
linelength.AddItem "80"
linelength.Text = linelength.List(3)
End If
End Sub
Sub comboutname_Click ()
'Select where to send the output
Select Case comboutname.Text
Case "LPT1"
outfile$ = "LPT1"
Case "LPT2"
outfile$ = "LPT2"
Case "COM1"
outfile$ = "COM1"
Case "COM2"
outfile$ = "COM2"
Case "file"
If file1.FileName = "" Then
comboutname.Text = "LPT1"
outfile$ = "LPT1"
Msg$ = "You must select an input filename first!"
MsgBox Msg$, 32
file1.SetFocus 'set focus to file list box
Exit Sub
End If
'Now make up a default output filename with same name and PRN as extension
outfile$ = UCase$(Left$(file1.FileName, InStr(file1.FileName, ".")) + "PRN")
Msg$ = NL$ + NL$ + " WAIT" + NL$
Msg$ = Msg$ + "Enter filename to print to:" + NL$ + NL$
Msg$ = Msg$ + "NOTE: Two files will be made -- one prefixed " '+ NL$
Msg$ = Msg$ + "with a 1 for side number one and another file " '+ NL$
Msg$ = Msg$ + "prefixed with a 2 for side number two. File extension MUST "
Msg$ = Msg$ + "be used!"
outfile$ = InputBox$(Msg$, "Output File Name", outfile$) 'Get a filename
If outfile$ <> "" Then
If InStr(outfile$, ".") = 9 Then 'got filename = 8 chars
outfile$ = "1" + Left$(outfile$, InStr(1, outfile$, ".") - 2) + ".PRN"
Else
outfile$ = "1" + outfile$ 'otherwise, just put a 1 on the front
End If
comboutname.Text = UCase$(outfile$) 'put filename in combo box
go.SetFocus
ToAFile = True
Else
comboutname.Text = "LPT1"
outfile$ = "LPT1"
file1.SetFocus 'set focus to file list box
ToAFile = False
End If
End Select
End Sub
Sub Dir1_Change ()
file1.Path = dir1.Path
file1.SetFocus
End Sub
Sub Dir1_Click ()
lastchange = dirsboxclick
End Sub
Sub DoMacro (num$)
'Was Static Sub ...
Print #2, ESC$; "&f"; num$; "y2X"; 'execute the macro
End Sub
Sub Drive1_Change ()
dir1.Path = drive1.Drive
End Sub
Sub EndMacro (num$)
'Was Static Sub ...
Print #2, ESC$; "&f"; num$; "y1X"; 'Send end of macro command
Print #2, ESC$; "&f"; num$; "y9X"; 'Make it temporary (10 to be permanent)
End Sub
Sub File1_Click ()
'use the following line to put filename in frame
'if using a frame:
'inname.caption = "Load " + file1.filename
lastchange = fileboxclick
End Sub
Sub File1_DblClick ()
Call go_click
End Sub
Sub Form_Click ()
'If user clicks on the form, call the about box
Call printlogo
End Sub
Sub Form_Load ()
'Set up the output combo box
comboutname.AddItem "LPT1"
comboutname.AddItem "LPT2"
comboutname.AddItem "COM1"
comboutname.AddItem "COM2"
comboutname.AddItem "file"
comboutname.Text = comboutname.List(0) 'default to LPT1
outfile$ = "LPT1"
'Set up the Line Length combo box
linelength.AddItem "65"
linelength.AddItem "70"
linelength.AddItem "75"
linelength.AddItem "80"
linelength.Text = linelength.List(3) 'default to 80
PC.Linelen = 80 'default to line length of 80
PC.tempmrg = 95 'default to right side left margin of 95
'set default check-box values
tune% = -1
PC.FileTitle = -1
PC.DoHeader = -1
PC.CurDate = -1
PC.PgNumber = -1
PC.LineWrap = -1
'set some variables
RightSide% = 1 'Reset these because of rerunning program
FirstPass% = -1 'Reset these because of rerunning program
ESC$ = Chr$(27) 'Standard ESC code
FF$ = Chr$(12) 'Page Feed
LF$ = Chr$(10) 'Line Feed
NL$ = Chr$(13) + Chr$(10) 'CR and LF
JustCount% = 0 'Not allowing "just counting"
' PC.Linelen = 80 'Maximum length of line
'Setup A2 or A4 paper sizes: 'Added this in Version 1.2b
PaperAmerican = True 'default to
PaperWidth = 175 ' American Paper Size
ToAFile = Fale
CenterForm VBBinp
VBBinp.Show
End Sub
Sub go_click ()
'This is the main code - everything is actually called from here
'Code for Drive, Directory, and File selections
If index >= 3 Then End
If lastchange = dirsboxclick Then
dir1.Path = dir1.List(dir1.ListIndex)
Else
If file1.FileName <> "" Then
ChDrive drive1.Drive
ChDir file1.Path
FileName$ = file1.FileName
Else
Msg$ = "Sorry! You must first select a file."
Abort% = MsgBox(Msg$, 49, "No application chosen.")
If Abort% = 2 Then 'cancel button
End
End If
End If
End If
lastchange = fileboxclick
ReDim ptrarray&(513) 'total number of pages (512)
On Error GoTo ErrorDept 'Error trapping
'Ensure that we have a file name (user may have clicked DoIt without
'entering a filename)
GetName:
If Len(FileName$) = 0 Then
If tune% Then Beep
Msg$ = "Enter a file name to print: "
Title$ = "Filename" ' Set title.
Default$ = ""
NewName$ = InputBox$(Msg$, Title$, Default$) ' Get user input.
If Len(NewName$) = 0 Then ' Check if valid.
Msg$ = "You did not input a valid Filename." + NL$
Msg$ = Msg$ + "Click on OK to End Program"
MsgBox Msg$, 0, Title$ ' Display message.
GoTo OutHere
End If
End If
'Build index array for pages in FileName$
'Done with main form so show Status form and provide updates
CenterForm status
status.Show
VBBinp.Hide
status.Print
status.Print "Available Memory: ";
status.FontItalic = True
status.Print GetFreeSpace(0)
status.FontItalic = False
status.Print
status.Print "Reading file: ";
status.FontItalic = True
status.Print FileName$
status.FontItalic = False
Call BuildArray(ptrarray&(), Page%) 'Built pointer array
'Figure number of pages needed
If Page% Mod 4 Then 'Even multiples of 4 only
Page% = Page% + (4 - Page% Mod 4) ' correct for less
End If
status.Print
status.Print "You will print";
status.FontItalic = True
status.Print Page% \ 4;
status.FontItalic = False
If Page% \ 4 > 1 Then
status.Print "sheets." 'Report total number of pages
Else
status.Print "sheet."
End If
status.Print
'JustCount% is set to false always right now
If JustCount% Then
Print "Press any key to continue, or ESC to cancel printing"
GoSub KeyIn
End If
'Start of printing routines
Open outfile$ For Output As #2 'Open printer or output file
Call PrintSetup 'Set up printer
'Page parsing variables
LeftSide% = Page%
RightSide% = 1
FirstPass% = -1
Open FileName$ For Binary As #1 'Open the input file
status.Print "Printing Side 1 to: "; 'Track what is going on
status.FontItalic = True
status.Print outfile$
status.FontItalic = False
'Status.Print
DoPass:
Bookmark% = (Page% \ 4) 'Flag for halfway through
If Bookmark% = 0 Then Bookmark% = 1 'Force 1 if too small
'Read text and send to printer or file
'Print the right side of the page first
Do
Junk% = DoEvents() 'yield some time to the system
If ptrarray&(RightSide% + 1) = 0 Then 'If blank, then skip it
GoTo NextPage
End If
Call DoMacro("2") 'Start on right side
LJLocate PC.tempmrg, 0
If PC.DoHeader Then Call Header(RightSide%) 'Header if needed
Buffer$ = Space$(ptrarray&(RightSide% + 1) - ptrarray&(RightSide%))
Get #1, ptrarray&(RightSide%), Buffer$ 'Read in a page
If InStr(Buffer$, FF$) Then 'If the last character is a Page Feed
Print #2, Left$(Buffer$, InStr(Buffer$, FF$) - 1); 'print only text
Else
Print #2, Buffer$; 'Otherwise print full line
End If
NextPage:
If ptrarray&(LeftSide% + 1) = 0 Then 'Don't print blank pages
GoTo NextPage1
End If
Call DoMacro("1") 'Reset margins for left side
LJLocate 0, 0 'Home the cursor
If PC.DoHeader Then Call Header(LeftSide%) 'Header if needed
'Setup buffer for input
Buffer$ = Space$(ptrarray&(LeftSide% + 1) - ptrarray&(LeftSide%))
If LeftSide% = 0 Then 'If pointing at blank page, skip
GoTo NextPage1
End If
Get #1, ptrarray&(LeftSide%), Buffer$ 'Read in a page
If InStr(Buffer$, FF$) Then 'if the last character is a Page Feed
Print #2, Left$(Buffer$, InStr(Buffer$, FF$) - 1); 'print only text
Else 'print only text
Print #2, Buffer$; 'otherwise print all
End If
NextPage1:
Print #2, FF$; 'Page feed
LeftSide% = LeftSide% - 2 'Calculate next page in series
RightSide% = RightSide% + 2
Bookmark% = Bookmark% - 1 'Track our progress
Loop Until Bookmark% = 0 'Print pages until halfway through
'Pause between sides to allow for paper reinsertion
If FirstPass% Then 'If side one, prompt and get 2nd side
FirstPass% = 0 'Flag for second pass
If ToAFile = False Then 'don't display the wait msg if going to a file
If tune% Then Beep
Msg$ = "First Pass has been Completed." + NL$
Msg$ = Msg$ + "Insert paper back in tray and Click OK." + NL$
Msg$ = Msg$ + "(Or cancel to abort.)"
Abort% = MsgBox(Msg$, 49, "Continue?")
If Abort% = 2 Then 'cancel button
GoTo PrtReset 'Reset printer and end program
End If
Else
'now close the outfile$ and reopen the second one for pass 2
Close #2
outfile$ = "2" + Right$(outfile$, Len(outfile$) - 1)
Open outfile$ For Output As #2 'Open printer or output file
End If
status.Print 'Report on progress
status.Print "Printing Side 2 to: ";
status.FontItalic = True
status.Print outfile$
status.FontItalic = False
status.Print
GoTo DoPass
End If 'End of first pass
'Printing is done now
Msg$ = "Printing completed."
If tune% Then Beep
MsgBox Msg$, 64, "Done"
PrtReset:
Print #2, ESC$; "E"; 'Reset laserjet
OutHere:
Close 'Close all files
Reset 'flush the buffers
Unload status
CenterForm VBBinp
VBBinp.Show
'CenterForm VBBook
'VBBook.Show
Exit Sub
'End 'We now restart instead of ending
'Error handler
ErrorDept:
Beep
Msg$ = "*** Error ***" + NL$
Select Case Err
Case 482
Msg$ = Msg$ + "Printer error."
Case 68
Msg$ = Msg$ + "Device is unavailable."
Case 71
Msg$ = Msg$ + "Insert a disk in the drive and close the door."
Case 57
Msg$ = Msg$ + "Device Input/Output Error (Check Printer!)."
Case 61
Msg$ = Msg$ + "Disk is full."
Case 64, 52
Msg$ = Msg$ + "That filename is illegal."
Case 76
Msg$ = Msg$ + "That path doesn't exist."
Case 54
Msg$ = Msg$ + "Can't open your file for that type of access."
Case 55
Msg$ = Msg$ + "This file is already open."
Case 62
Msg$ = Msg$ + "This file has a nonstandard end-of-file marker" + NL$
Msg$ = Msg$ + "or an attempt was made to read beyond the end-" + NL$
Msg$ = Msg$ + "of-file marker."
Case Else
Msg$ = Msg$ + "Error number " + Str$(Err)
End Select
GoSub AWayOut
Resume
AWayOut:
Abort% = MsgBox(Msg$, 17, "ERROR")
KeyIn:
If Abort% = 2 Then 'If user presses Cancel, Exit
Close
Reset
GoTo restart
'End
End If
Return
restart:
End Sub
Sub Header (Page%)
'Was Static Sub ...
hdr$ = Space$(PC.Linelen) 'Create a string to print
If PC.FileTitle Then 'Print the filename
Mid$(hdr$, (PC.Linelen \ 2) - (Len(FileName$) \ 2)) = UCase$(FileName$)
End If
If PC.PgNumber Then 'Print the current page
PTemp$ = "Page" + Str$(Page%)
If Page% Mod 2 Then
Mid$(hdr$, PC.Linelen - Len(PTemp$)) = PTemp$ 'odd page, right side
Else
Mid$(hdr$, 1) = PTemp$ 'even page, left side
End If
End If
If PC.CurDate Then 'Print the current date
If Page% Mod 2 Then
Mid$(hdr$, 1) = Date$ 'even page, left side
Else
Mid$(hdr$, PC.Linelen - Len(Date$)) = Date$ 'odd page, right side
End If
End If
Print #2, hdr$ 'Print the Header
Print #2, ' and skip a line for readability
End Sub
Sub Label1_load ()
'This section is not used at this time
Print String$(80, 61)
Print "VBBook - Booklet Printing Utility"
Print
Print "Converted to Visual Basic by Dennis Scott"
Print String$(80, 61)
End Sub
Sub Linelength_Change ()
'Prevent the user from entering a value over 90 (Changed in version 1.2b for A4 paper)
If Val(linelength.Text) > 80 Then
If PaperAmerican Then
linelength.Text = "80"
Else
If Val(linelength.Text) > 90 Then
linelength.Text = "90"
End If
End If
End If
'If the user just typed the value into the box then compute it here
PC.Linelen = Val(linelength.Text) 'convert string to number
If PaperAmerican Then
'Compute temp right margin, 95 if 80 linelength
PC.tempmrg = (110 - PC.Linelen - 15) + 80
Else
PC.tempmrg = (110 - PC.Linelen - 15) + 95 'Compute temp right margin
End If
End Sub
Sub Linelength_Click ()
'Allow line lengths upto 80
'We prevent the line length from being over 90 with Linelength.Change
PC.Linelen = Val(linelength.Text) 'convert string to number
PC.tempmrg = (110 - PC.Linelen - 15) + 80 'Compute temp right margin
'values are (PC.Linelen,PC.tempmrg): 90,85 ;80,95; 75,100; 70,105; 65,110
'of course values will be different for other line lengths
End Sub
Sub LJLocate (x%, Y%) 'Laser Jet cursor locate
'Was Static Sub ...
Temp$ = ESC$ + "&a" + LTrim$(Str$(Y%)) + "r" + LTrim$(Str$(x%)) + "C"
Print #2, Temp$;
End Sub
Sub Picture1_Click ()
Call printlogo 'Show the "about" box
End Sub
Sub printlogo () 'Banner logo
'Was Static Sub ...
Msg$ = " VB Book Ver 1.3" + NL$
Msg$ = Msg$ + " Converted to Visual Basic" + NL$
Msg$ = Msg$ + " by Dennis Scott." + NL$
Msg$ = Msg$ + NL$
Msg$ = Msg$ + "Send Comments/Suggestions to:" + NL$
Msg$ = Msg$ + " CompuDirect" + NL$
Msg$ = Msg$ + " 7711 Butler Road" + NL$
Msg$ = Msg$ + " Myrtle Beach, SC" + NL$
Msg$ = Msg$ + " (803)650-7460" + NL$
MsgBox Msg$, 0, "About VB Book"
End Sub
Sub PrintSetup () 'Send codes to prepare printer
Print #2, ESC$; "E"; 'Reset laserjet (simple isn't it!)
Print #2, ESC$; "&l1o5.45C"; 'Select lineprinter font"
Print #2, ESC$; "(s0p16.66H"; ' and pitch
Print #2, ESC$; "&l0L"; 'Turn off page feed at 66 lines
If PC.LineWrap Then 'Wrap lines > 80 chars
Print #2, ESC$; "&s0C";
End If
Print #2, ESC$; "&l2E"; 'Top margin 2 lines
Call StartMacro("1") 'Left side macro
Print #2, ESC$; "9"; 'Reset left - right margins
Print #2, ESC$; "&a0l" + Str$(PC.Linelen) + "M"; 'set left margin 0, right Line Length
Call EndMacro("1")
Call StartMacro("2") 'Right side macro
Print #2, ESC$; "9"; 'Reset left - right margins
'set left margin, right 175 for A2 or 185 for A4 paper
Print #2, ESC$; "&a" + Str$(PC.tempmrg) + "l" + Str$(PaperWidth) + "M";
Call EndMacro("2")
End Sub
Sub StartMacro (num$)
'Was Static Sub ...
Print #2, ESC$; "&f"; num$; "Y"; 'Macro will have an id of Num$
Print #2, ESC$; "&f0X"; 'Start the macro now
End Sub