home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
wp
/
vbbook13.zip
/
VBBINP13.FRM
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1993-04-04
|
23KB
|
508 lines
VBBinp
VB Book Input
Form1,
Print Filename on each Page
Cancel
Cancel
Do It
Print Date/Time on each Page
Picture1
wwwwwwwwwwwwwwp
wwwwwwwwwwwwwp
Print Page Numbers
Use Speaker
Text1
Text Width:
Set Line Wrap On
Linelength
A2 (American) Paper or A4 if off
Drive1
File1
Outname
Output To:
comboutname
Combooutname_Change
go_click
pcbook'
Check1_Click
go2_clickN
ptrarrayY
ErrorDept
outfile\
JustCount#
PC_LineLen,
filename:
PC_CurDateJ
PC_DoHeadero
PC_FileTitle{
PC_PgNumber
PC_LineWrap:
OutHere
GetName
Title
Default
NewName.
pcbinp
BuildArray
Pages
KeyIn
PrintSetupW
LeftSide
RightSide
FirstPass
DoPass
Bookmark
NextPage
DoMacro
LJLocate
HeaderM
Buffer3
NextPage1a
WaitKey
Abort
PrtReset
ERDEV
AWayOut
Flags
pgcount@
MaxLines
Offset
TotalSize
FileLeft
memAvail
SixteenK
BufAvail
BuffSizeJ
LnCount
GetPage
stptr
LastLineT
PageCheck
TempLn|
temppg
PageBreak6
EndBuild}
Label1_load
EndMacro
PTemp
@ printlogo
StartMacro
Form_Click
Dir1_Change
file1
patht
Dir1_Click}
lastchange
dirsboxclick>
fileboxclickb
File1_ClickM
frame1D
caption
File1_DblClick
button_Click
Button
index
listindex@
drive1l
drive
inname
Inname_DragDrop
Source
clk1_Click
clk2_Click
clk3_Click
clk4_ClickU
clk5_Clickg
Outname_DragDropb
PCBOUTPUT
scroutput
PCBOUT
Drive1_Change
Cancel_Click
comboutname_Change
@ Form_Load
comboutnamex
comboutname_Click
comoutname
Click>
abortit
Dennisi
Scott,
ustCountP
lengthW
padspco
FunctionpadS
msglen
Picture1_Click
VBBinp
VBBOUT
PCLineWrap
PCLinelen
PCFileTitle
PCPgNumber
PCCurDate
PCDoHeader
False
value
comboutname_GotFocus
comboutname_LostFocus
LineWrapd
Linelen
FileTitle
PgNumber
CurDate6
DoHeader
Linelength_Change
Linelength_Click
linelength
tempmrg
status
Staus
fontitalic
Text1_Change%
CMDialog1
Clk6_Click
PaperAmericanV
PaperWidth
Form_LinkClosej
Form_KeyUp;
KeyCode
Shift+
Form_MouseDown
listcount
Enddo#
maxI
ToAFile
prefixed|
another
restart
unload
VBBook
errdept
GetFreeSpacec
CenterForm
Screen
Mousepointer
Height
Width
BuildArray
Was Satic Sub ...b
Maximum number of lines)
Start of file (seek point)
Open file to check
Get LEN of file so we don't read too far
Setup a counter to show whats left
FRE is not supported by VB. Use GetFreeSpace() instead (see global module)
65536 FRE(FileName$) - 2048 'Check available string memory
Force out of memory error
Set a buffer sizer
If the file is larger than 16K
Set it to 16ks
Otherwise set it to file sizeo
Initialize page counts
First pointer is always 1a
Initialize line countl
Read the filea
Check amount left to readl
If less than our buffer, use lessor
Otherwise use full buffer size
Read in a buffers worthf
Pointer into buffer$
remember last position
yield some time to the system
Position of next linefeed
Position of next pagefeeds
If there was a page feed
was it before our linefeed?r
yes then bump page count
set next array element
set instr pointer
reset linecountf
and loop back for more
Linefeed
If Line Wrap, check length
Greater than 80?
check for line wrapr
increment line
> 66 lines
Increment page count
Too may pages - printing only 512.
Notice
point to next point in file
point ahead 1 byte for next scan
keep checking
Pointer into file (tally)n
Reset Buffer pointer
Calculate how much is left
If more text in file, keep going
Set last pointer to end of fileg
Close input file
End of BuildArray Sub
Label1_load
This section is not used at this timee
VBBook - Booklet Printing Utility"u
Converted to Visual Basic by Dennis Scott"u
DoMacro
Was Static Sub ...
y2X"t
execute the macro
EndMacro
Was Static Sub ...
y1X"t
Send end of macro command
y9X"t
Make it temporary (10 to be permanent)
Header
Was Static Sub ...
Create a string to print
Print the filename
Print the current page
odd page, right side
even page, left side
Print the current date
even page, left side
odd page, right side
Print the Header
and skip a line for readability
LJLocate
Laser Jet cursor locaten
Was Static Sub ...
printlogo
Banner logo
Was Static Sub ...
VB Book Ver 1.3
Converted to Visual Basic
by Dennis Scott."
Send Comments/Suggestions to:"
CompuDirect
7711 Butler Road"
Myrtle Beach, SC"
(803)650-7460
About VB Book"
PrintSetup
Send codes to prepare printerd
Reset laserjet (simple isn't it!)r
&l1o5.45C"t
Select lineprinter font"
(s0p16.66Ht
and pitchp
&l0Lt
Turn off page feed at 66 lines
Wrap lines > 80 chars
&s0Ct
&l2Et
Top margin 2 lines
Left side macro
Reset left - right margins
set left margin 0, right Line Length
Right side macro
Reset left - right margins
set left margin, right 175 for A2 or 185 for A4 paperr
StartMacro
Was Static Sub ...
Macro will have an id of Num$
&f0Xt
Start the macro nowr
Form_Click
If user clicks on the form, call the about box
go_click
This is the main code - everything is actually called from here
Code for Drive, Directory, and File selections
Sorry! You must first select a file."
No application chosen.
cancel buttonc
total number of pages (512)
Error trapping
Ensure that we have a file name (user may have clicked DoIt withoutt
entering a filename)
Enter a file name to print:
Filename
Set title.n
Get user input.
Check if valid.
You did not input a valid Filename."
Click on OK to End Program
Display message.
Build index array for pages in FileName$
Done with main form so show Status form and provide updatesn
Available Memory: t
Reading file: t
Built pointer arrayF
Figure number of pages neededn
Even multiples of 4 only
correct for less
You will printt
sheets."u
Report total number of pages
sheet.u
JustCount% is set to false always right now
Press any key to continue, or ESC to cancel printingu
Start of printing routines
Open printer or output file
Set up printer
Page parsing variables
Open the input filep
Printing Side 1 to: t
Track what is going on
Status.Print
Flag for halfway through
Force 1 if too small
Read text and send to printer or file;
Print the right side of the page first
yield some time to the systemt
If blank, then skip it
Start on right siden
Header if needed
Read in a page
If the last character is a Page Feed
print only texth
Otherwise print full liney
Don't print blank pages
Reset margins for left sidee
Home the cursorg
Header if needed
Setup buffer for input
If pointing at blank page, skipr
Read in a page
if the last character is a Page Feed
print only texti
print only text
otherwise print alln
Page feed
Calculate next page in seriesi
Track our progress
Print pages until halfway throught
Pause between sides to allow for paper reinsertion
If side one, prompt and get 2nd side
Flag for second pass
don't display the wait msg if going to a file
First Pass has been Completed.
Insert paper back in tray and Click OK."
(Or cancel to abort.)"
Continue?"
cancel button
Reset printer and end program
now close the outfile$ and reopen the second one for pass 2
Open printer or output filee
Report on progress
Printing Side 2 to: t
End of first passS
Printing is done now
Printing completed."
Reset laserjet
Close all files"
flush the buffersd
CenterForm VBBookB
VBBook.Show.
) 'We now restart instead of ending
Error handler
*** Error ***"
Printer error.
Device is unavailable.
Insert a disk in the drive and close the door.
Device Input/Output Error (Check Printer!)."
Disk is full."
That filename is illegal."
That path doesn't exist.
Can't open your file for that type of access."
This file is already open.
This file has a nonstandard end-of-file marker
or an attempt was made to read beyond the end-
of-file marker."
Error number "
ERROR"
If user presses Cancel, Exit
Dir1_Change
Dir1_Click
File1_Click
use the following line to put filename in framef
if using a frame:
inname.caption = "Load " + file1.filenamee
File1_DblClick
clk1_Click
Toggle on/offe
Still have to do the Header if clk2 or clk3 buttons are checked
clk2_Click
Toggle on/offT
Still have to do the Header if clk1 or clk3 buttons are checked
clk3_Click
Toggle on/offT
Still have to do the Header if clk1 or clk2 buttons are checked
clk4_Click
Toggle on/offT
clk5_Click
Toggle on/offT
Drive1_Change
Cancel_Click
If user clicks on the cancel button then ...
Form_Load
Set up the output combo boxo
default to LPT1e
Set up the Line Length combo box
default to 80T
default to line length of 80
default to right side left margin of 95t
set default check-box values
set some variables
Reset these because of rerunning program
Reset these because of rerunning program
Standard ESC codet
Page Feed
Line Feed
CR and LFd
Not allowing "just counting"
PC.Linelen = 80
'Maximum length of line
Setup A2 or A4 paper sizes:
'Added this in Version 1.2br
default to
American Paper Size
comboutname_Click
Select where to send the output
LPT1&
LPT2&
COM1&
COM2&
file&
You must select an input filename first!
set focus to file list box
Now make up a default output filename with same name and PRN as extensionn
WAIT
Enter filename to print to:"
NOTE: Two files will be made -- one prefixed
+ NL$
with a 1 for side number one and another file
+ NL$
prefixed with a 2 for side number two. File extension MUST
be used!
Output File Name
Get a filename
got filename = 8 chars
otherwise, just put a 1 on the front
put filename in combo boxU
set focus to file list box
Picture1_Click
Show the "about" box
Linelength_Click
Allow line lengths upto 80
We prevent the line length from being over 90 with Linelength.Change
convert string to number
Compute temp right margint
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 lengthsn
Linelength_Change
Prevent the user from entering a value over 90 (Changed in version 1.2b for A4 paper)
If the user just typed the value into the box then compute it here
convert string to number
Compute temp right margin, 95 if 80 linelength
Compute temp right margin
Clk6_Click
if true, changing to A4
A4 (British) paper width
right side left margin ofa
PC.tempmrg = 90
'right side left margin of
A2 (American) papere
right side left margin of 95
linelength.text = "80"