-
Notifications
You must be signed in to change notification settings - Fork 6
/
frmConsole.frm
executable file
·203 lines (178 loc) · 4.99 KB
/
frmConsole.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
VERSION 5.00
Begin VB.Form frmConsole
BackColor = &H00000000&
Caption = "cmd.exe"
ClientHeight = 3680
ClientLeft = 40
ClientTop = 280
ClientWidth = 6920
ForeColor = &H00FFFFFF&
Icon = "frmConsole.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3680
ScaleWidth = 6920
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.Timer tmrTyping
Enabled = 0 'False
Interval = 50
Left = 360
Top = 0
End
Begin VB.Timer tmrCode
Enabled = 0 'False
Interval = 50
Left = 0
Top = 0
End
Begin VB.TextBox txtCmd
BackColor = &H00000000&
BorderStyle = 0 'None
BeginProperty Font
Name = "Lucida Console"
Size = 8
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 2650
Left = 0
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 360
Width = 6850
End
Begin VB.Timer tmrHide
Enabled = 0 'False
Interval = 1000
Left = 720
Top = 0
End
End
Attribute VB_Name = "frmConsole"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public m_Active As Boolean
Private m_lLife As Long 'life in seconds
Private m_lAge As Long 'age in seconds
Private m_CodeLines() As String
Private m_CodeLinesI As Long
Private m_CodeTypingI As Long
Public Sub Init(lLife As Long)
m_lLife = lLife
tmrHide_Timer
LoadCode
End Sub
Public Sub Start()
Show
tmrCode.Enabled = True
m_Active = True
End Sub
Public Sub Unstart()
Hide
On Error Resume Next
Dim t As Timer
For Each t In Me.Controls
t.Enabled = False
Next t
On Error GoTo 0
m_lLife = 0
m_lAge = 0
ReDim m_CodeLines(0)
m_CodeLinesI = 0
m_CodeTypingI = 0
txtCmd.Text = ""
m_Active = False
End Sub
Private Sub LoadCode()
Dim i As Long, x As Long, arr() As String
ReDim m_CodeLines(0 To 0)
m_CodeLines(0) = ""
m_CodeLinesI = -1
'pick some snips at random
Randomize Timer
x = Int(Rnd() * y_SnipsVarN) + y_SnipsMinN
ReDim arrF(0 To x)
For i = 0 To UBound(arrF)
x = Int(Rnd() * (UBound(y_AllCodeSnips) + 1))
arr = Split(y_AllCodeSnips(x), vbNewLine)
For x = 0 To UBound(arr)
If Len(m_CodeLines(UBound(m_CodeLines))) > 0 Then ReDim Preserve m_CodeLines(0 To UBound(m_CodeLines) + 1)
m_CodeLines(UBound(m_CodeLines)) = arr(x)
Next x
Next i
End Sub
Private Sub ConsoleAdd(s As String)
If Len(txtCmd.Text) + Len(s) >= 65535 Then
txtCmd.Text = ""
End If
txtCmd.SelStart = Len(txtCmd.Text)
txtCmd.SelText = s
txtCmd.SelStart = Len(txtCmd.Text)
End Sub
Private Sub Form_Activate()
KeepOnTop Me, True
End Sub
Private Sub Form_Load()
m_Active = False
m_lAge = 0
txtCmd.ForeColor = prf_ConsoleText
txtCmd.BackColor = prf_ConsoleBack
tmrCode.Interval = y_CodeLineInt
tmrTyping.Interval = y_CodeChrInt
End Sub
Private Sub Form_Resize()
txtCmd.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unstart
End Sub
Private Sub tmrCode_Timer()
m_CodeLinesI = m_CodeLinesI + 1
If m_CodeLinesI > UBound(m_CodeLines) Then
tmrCode.Enabled = False
tmrHide.Enabled = True
ElseIf Mid(m_CodeLines(m_CodeLinesI), 1, 1) = "." Or _
Mid(m_CodeLines(m_CodeLinesI), 1, 1) = "," Then
tmrCode.Enabled = False
m_CodeLines(m_CodeLinesI) = Mid(m_CodeLines(m_CodeLinesI), 2)
m_CodeTypingI = 0
If Len(txtCmd.Text) > 0 Then
ConsoleAdd vbNewLine
End If
tmrTyping.Enabled = True
If Mid(m_CodeLines(m_CodeLinesI), 1, 1) = "." Then Show
Else
If Len(txtCmd.Text) > 0 Then
ConsoleAdd vbNewLine & m_CodeLines(m_CodeLinesI)
Else
ConsoleAdd m_CodeLines(m_CodeLinesI)
End If
End If
End Sub
Private Sub tmrTyping_Timer()
ConsoleAdd Mid(m_CodeLines(m_CodeLinesI), m_CodeTypingI + 1, 1)
m_CodeTypingI = m_CodeTypingI + 1
If m_CodeTypingI > Len(m_CodeLines(m_CodeLinesI)) Then
tmrTyping.Enabled = False
tmrCode.Enabled = True
End If
End Sub
Private Sub tmrHide_Timer()
If Not tmrHide.Enabled Then Exit Sub
m_lAge = m_lAge + 1
If m_lAge > m_lLife Then
y_ConsoleDie Me
tmrHide.Enabled = False
ElseIf m_lLife - m_lAge < 2 Then '2 second warning so another can be spawned just before this one closes
y_ConsoleAboutToDie Me
End If
End Sub