📄 yhj_shushengprinter.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "文件名"
ClientHeight = 7095
ClientLeft = 60
ClientTop = 450
ClientWidth = 10410
LinkTopic = "Form1"
ScaleHeight = 7095
ScaleWidth = 10410
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消打印"
Enabled = 0 'False
Height = 375
Left = 6420
TabIndex = 15
Top = 3900
Width = 1155
End
Begin VB.TextBox pp2
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 4560
TabIndex = 13
Top = 3900
Width = 1575
End
Begin VB.TextBox pp1
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 11
Top = 3900
Width = 1575
End
Begin VB.TextBox Tp2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4560
TabIndex = 9
Text = "10"
Top = 1500
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "开始打印"
Height = 375
Left = 2520
TabIndex = 8
Top = 3300
Width = 1155
End
Begin VB.TextBox tpn
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 7
Top = 2700
Width = 5295
End
Begin VB.TextBox Td
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 5
Text = "0.2"
Top = 2100
Width = 5295
End
Begin VB.TextBox Tp1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 3
Text = "1"
Top = 1500
Width = 1575
End
Begin VB.TextBox Tname
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 1
Top = 900
Width = 5295
End
Begin VB.Label Label7
Caption = "至"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4200
TabIndex = 14
Top = 4020
Width = 375
End
Begin VB.Label Label6
Caption = "正打印页码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1080
TabIndex = 12
Top = 3960
Width = 1335
End
Begin VB.Label Label5
Caption = "至"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4200
TabIndex = 10
Top = 1620
Width = 375
End
Begin VB.Label Label4
Caption = "打印名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1560
TabIndex = 6
Top = 2760
Width = 975
End
Begin VB.Label Label3
Caption = "延时"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1800
TabIndex = 4
Top = 2160
Width = 615
End
Begin VB.Label Label2
Caption = "起止页码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 2
Top = 1560
Width = 975
End
Begin VB.Label Label1
Caption = "图书名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1560
TabIndex = 0
Top = 960
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Dim cyes, dvalue
Private Sub Command1_Click()
Command2.Enabled = True
Command1.Enabled = False
p1 = Val(Trim(Tp1.Text))
p2 = Val(Trim(Tp2.Text))
bn = Trim(Tname.Text)
dvalue = Val(Td.Text)
pp = p1
cyes = False
Do
rdo:
AppActivate "书生阅读器 - [" & bn & "]"
Call delay(0.3)
DoEvents
SendKeys "^p"
DoEvents
t = Timer
Do While cyes = False
hw& = FindWindow(vbNullString, "打印")
If hw <> 0 Then Exit Do
DoEvents
If (Timer - t) > 0.5 Or (t > Timer And Timer - t + 86400 > 0.5) Then GoTo rdo
Loop
rdo2:
Call delay(0.2)
SendKeys "%s"
Call delay(0.1)
SendKeys "{TAB}{TAB}{TAB}"
ppt = pp + 9
If ppt > p2 Then ppt = p2
SendKeys Trim(pp) & "-" & Trim(ppt) & "~"
pp1 = pp
pp2 = ppt
Call delay(0.3)
t = Timer
Do While cyes = False
hw& = FindWindow(vbNullString, "打印到文件")
If hw <> 0 Then Exit Do
DoEvents
If (Timer - t) > 0.5 Or (t > Timer And Timer - t + 86400 > 0.5) Then
AppActivate "打印"
GoTo rdo2
End If
Loop
If cyes = False Then
AppActivate "打印到文件"
Call delay(0.1)
SendKeys Left(bn, 1) & "_" & Trim(Format(pp, "0000")) & ".ps~"
pp = pp + 10
Call delay(0.1)
End If
t = Timer
Do While cyes = False
hw& = FindWindow(vbNullString, "打印中 ...")
If hw <> 0 Then Exit Do
DoEvents
If (Timer - t) > 100 Or (t > Timer And Timer - t + 86400 > 100) Then
cyes = False
End If
Loop
t = Timer
Do While cyes = False
hw& = FindWindow(vbNullString, "打印中 ...")
If hw = 0 Then Exit Do
DoEvents
If (Timer - t) > 100 Or (t > Timer And Timer - t + 86400 > 100) Then
cyes = False
End If
Loop
Call delay(0.1)
Loop Until ppt >= p2 Or cyes = True
cyes = False
Command1.Enabled = True
Command2.Enabled = False
End Sub
Sub delay(x)
n = 1
t = Timer
Do
n = n + 1
DoEvents
Loop Until n > 1000 And Abs(t - Timer) > x
End Sub
Private Sub Command2_Click()
cyes = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -