📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 375
Left = 600
TabIndex = 0
Top = 2160
Width = 2175
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Left = 600
TabIndex = 1
Top = 840
Width = 540
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim TimeCalc As Date
TimeCalc = Timer
Label1.Caption = "希望本计算机让您使用愉快!!!"
'计数控制
Do While Timer - TimeCalc < 1
DoEvents
Loop
Unload Me
End Sub
Private Sub Form_Load()
Dim Today As Date
Dim DayString As String
Dim PathString As String
Dim DateRec As Integer
Command1.Caption = "退出"
Today = Now '保存当前系统日期及时间
PathString = App.Path
If Right(PathString, 1) <> "\" Then
PathString = PathString + "\"
End If
If Dir(PathString + "StartPcTime.log") <> "" Then
DateRec = FreeFile '系统自动生成程序中没有使用的文件号并赋值给变量 DateRec
Open PathString + "StartPcTime.log" For Input As #DateRec '以输入方式打文件号DateRec的文件,以便从该文件中读取内容
Line Input #DateRec, DayString '从已打开记录号DateRec的文件中顺序读取一行完整的记录,并保存在变量DayString中。
Close #DateRec
Label1.Caption = "你上次开机的时间是[" & DayString & "]"
Else
Label1.Caption = "你是第一次使用本计算机!!!"
End If
DateRec = FreeFile '重新分配未使用过的文件号,并赋给DataRec变量
Open PathString + "StartPcTime.log" For Output As #DateRec 'Output 表示从内存输出到指定文件
DayString = Today '将已赋值为当前系统日期及时间的变量Today再次赋给DayString变量
'Print #DateRec, DayString '将变量DayString的内容写入(print#,注:Print的对象是什么 )文件号为DateRec的变量
Write #DateRec, DayString
Close #DateRec
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -