
监视计算机的开机和关机时间(vb代码)
DimbegintimePrivateSubForm_Load()Me.Hidebegintime=NowEndSubPrivateSubForm_Unload(Canc...
Dim begintime
Private Sub Form_Load()
Me.Hide
begintime=Now
End Sub
Private Sub Form_Unload(Cancel As Integer)
endtime=Now
n=DateDiff(〃N〃,begintime,endtime)
Dim fso As New FileSystemObject
Dim txtfile As TextStream
Set a=App
If fso.FileExists(a.Path & 〃开机记录.txt〃) Then
Set txtfile=fso.OpenTextFile(a.Path & 〃开机记录.txt〃,ForAppending)
Else
Set txtfile=fso.OpenTextFile(a.Path & 〃开机记录.txt〃,ForWriting,True)
End If
txtfile.Write 〃开机时间〃 & begintime
txtfile.Write 〃 〃&〃关机时间〃& endtime
txtfile.Write 〃 〃&〃时间长度〃& n & 〃分钟〃
txtfile.WriteBlankLines 2
End Sub
哪里错了?能帮我修改吗? 展开
Private Sub Form_Load()
Me.Hide
begintime=Now
End Sub
Private Sub Form_Unload(Cancel As Integer)
endtime=Now
n=DateDiff(〃N〃,begintime,endtime)
Dim fso As New FileSystemObject
Dim txtfile As TextStream
Set a=App
If fso.FileExists(a.Path & 〃开机记录.txt〃) Then
Set txtfile=fso.OpenTextFile(a.Path & 〃开机记录.txt〃,ForAppending)
Else
Set txtfile=fso.OpenTextFile(a.Path & 〃开机记录.txt〃,ForWriting,True)
End If
txtfile.Write 〃开机时间〃 & begintime
txtfile.Write 〃 〃&〃关机时间〃& endtime
txtfile.Write 〃 〃&〃时间长度〃& n & 〃分钟〃
txtfile.WriteBlankLines 2
End Sub
哪里错了?能帮我修改吗? 展开
展开全部
"txtfile.Write 〃 〃&〃关机时间〃& endtime
txtfile.Write 〃 〃&〃时间长度〃& n & 〃分钟〃"
这里错了!
引号用错了!
好好看看书马上就明白了!
txtfile.Write 〃 〃&〃时间长度〃& n & 〃分钟〃"
这里错了!
引号用错了!
好好看看书马上就明白了!

2023-06-12 广告
51单片机中的工作寄存器是一种特殊的寄存器,它存储的数据可以在单片机的工作时钟周期内被修改。工作寄存器通常用于存储操作数、传输数据或执行其他常规操作。由于51单片机具有许多指令可以直接访问内部的工作寄存器,因此工作寄存器在单片机编程中具有重...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询