📄 机房管理客户端主窗口.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "账户信息"
ClientHeight = 5625
ClientLeft = 4785
ClientTop = 3570
ClientWidth = 6975
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 375
ScaleMode = 3 'Pixel
ScaleWidth = 465
ShowInTaskbar = 0 'False
Begin MSWinsockLib.Winsock Winsock1
Left = 840
Top = 3960
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.Timer Timer1
Interval = 1000
Left = 360
Top = 3960
End
Begin VB.CommandButton Command1
Caption = "隐 藏"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
MousePointer = 5 'Size
TabIndex = 10
Top = 3480
Width = 1215
End
Begin VB.TextBox Text2
BackColor = &H8000000F&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
Locked = -1 'True
TabIndex = 9
TabStop = 0 'False
Top = 1320
Width = 1815
End
Begin VB.TextBox Text5
BackColor = &H8000000F&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5280
Locked = -1 'True
TabIndex = 8
TabStop = 0 'False
Top = 1320
Width = 1335
End
Begin VB.TextBox Text4
BackColor = &H8000000F&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5280
Locked = -1 'True
TabIndex = 7
TabStop = 0 'False
Top = 600
Width = 1335
End
Begin VB.TextBox Text3
BackColor = &H8000000F&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
Locked = -1 'True
TabIndex = 6
TabStop = 0 'False
Top = 2160
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H8000000F&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
Locked = -1 'True
TabIndex = 5
TabStop = 0 'False
Top = 600
Width = 1815
End
Begin VB.Label Label5
Caption = "是否免费:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 4
Top = 1320
Width = 1815
End
Begin VB.Label Label4
Caption = "账户余额:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 3
Top = 600
Width = 1815
End
Begin VB.Label Label3
Caption = "班级:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 2
Top = 2160
Width = 1335
End
Begin VB.Label Label2
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 1
Top = 1320
Width = 1335
End
Begin VB.Label label1
Caption = "账号:"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 0
Top = 600
Width = 1335
End
Begin VB.Menu popupgg
Caption = "系统信息"
Visible = 0 'False
Begin VB.Menu showinfo
Caption = "显示信息"
End
Begin VB.Menu changpassword
Caption = "修改密码"
End
Begin VB.Menu shutdown
Caption = "关机"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim week As Integer '记录当前第几周
Dim flag As Boolean '标记是否免费
Dim rest As Long
Dim t_arr(9) As Variant '存储每一节课的开始时间
Private Sub changpassword_Click()
Dialog.Show 1
End Sub
Private Sub Command1_Click()
Me.WindowState = vbMinimized
Dim myData As NOTIFYICONDATA
With myData
.cbSize = Len(myData)
.hwnd = Me.hwnd
.uID = 0
.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon.Handle '默认为窗口图标
.szTip = "提示" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, myData
End Sub
Private Sub Form_Click()
Me.PopupMenu popupgg
End Sub
Private Sub Form_Load()
Text1.Text = rec_base.Fields(0)
Text2.Text = rec_base.Fields(1)
Text3.Text = rec_class.Fields(1)
Text4.Text = rec_count.Fields(1)
Text5.Text = "计费上机"
cost = rec_sys_info.Fields(7).Value
rec_used.AddNew
rec_used.Fields(0).Value = Text1.Text
rec_used.Fields(1).Value = Now
rec_used.Fields(3).Value = Winsock1.LocalIP
rec_used.Update
'查询是否免费上机
question
If flag = False Then '计费用户
c = rec_count.Fields(1).Value '剩余金额
rest = c * (3600 / cost)
End If
Set rec_base = Nothing
Set rec_class = Nothing
Set rec_sys_info = Nothing
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case CLng(X)
Case WM_RBUTTONUP '鼠标在图标上右击时弹出菜单
Me.PopupMenu popupgg
Case WM_LBUTTONUP '鼠标在图标上左击时窗口若最小化则恢复窗口位置
If Me.WindowState = vbMinimized Then
Me.Show
Me.WindowState = vbNormal
Me.SetFocus
End If
End Select
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
rec_used.Fields(2).Value = Now
End Sub
Private Sub showinfo_Click()
Form1.Show
Me.WindowState = vbNormal
End Sub
Private Sub shutdown_Click()
Unload Me
End
'ShutDownPC
End Sub
Private Sub Timer1_Timer()
rest = rest - 1
If rest = 300 Then
MsgBox "离结束还有5分钟,请保存文档"
End If
If rest <= 0 Then End
If flag = False Then
Text4.Text = rec_count.Fields(1).Value - cost / 3600
rec_count.Fields(1).Value = rec_count.Fields(1).Value - cost / 3600
rec_count.Update
End If
End Sub
Sub question() '查询是否免费上机
Dim weekstart As String
Dim lessonlong As Integer, lessonbetween As Integer, biglessonbetween As Integer
weekstart = rec_sys_info.Fields(1).Value '获取第一周的开始日期
lessononetime = rec_sys_info.Fields(2).Value '获取第一节课的开始时间
lessonfivetime = rec_sys_info.Fields(3).Value '获取第五节课的开始时间
lessonlong = rec_sys_info.Fields(4).Value
lessonbetween = rec_sys_info.Fields(5).Value
biglessonbetween = rec_sys_info.Fields(6).Value
t_arr(1) = lessononetime
t_arr(2) = lessononetime + TimeSerial(0, lessonlong + lessonbetween, 0)
t_arr(3) = t_arr(2) + TimeSerial(0, lessonlong + biglessonbetween, 0)
t_arr(4) = t_arr(3) + TimeSerial(0, lessonlong + lessonbetween, 0)
t_arr(5) = lessonfivetime
t_arr(6) = t_arr(5) + TimeSerial(0, lessonlong + lessonbetween, 0)
t_arr(7) = #6:30:00 PM#
t_arr(8) = t_arr(7) + TimeSerial(0, lessonlong + lessonbetween, 0)
l = DateDiff("d", weekstart, Date)
week = l \ 7 + 1 'week为第几周
For i = 0 To 2
If week > rec_class.Fields(2 + 6 * i).Value And week < rec_class.Fields(2 + 6 * i + 1).Value Then
If rec_class.Fields(2 + 6 * i + 3) = "每周" Or rec_class.Fields(2 + 6 * i + 3) = "单周" And week Mod 2 = 1 Or rec_class.Fields(2 + 6 * i + 3) = "双周" And week Mod 2 = 0 Then
If Weekday(Date, vbMonday) = rec_class.Fields(2 + 6 * i + 2).Value Then
If Time > t_arr(Int(Val(rec_class.Fields(2 + 6 * i + 4)))) And Time < t_arr(Int(Val(rec_class.Fields(2 + 6 * i + 4)))) + TimeSerial(0, 0, 60 * ((Int(Val(rec_class.Fields(2 + 6 * i + 5))) * lessonlong) + 5)) Then
Text5.Text = "免费上机"
flag = True
rest = 60 * 100 - DateDiff("s", t_arr(Int(Val(rec_class.Fields(2 + 6 * i + 4)))), Time)
Exit Sub
End If
End If
End If
End If
Next i
flag = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -