by Tryambak Chatterjee (2 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 3rd June 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This simple program keeps a log record of when your computer is opened. Without any one's notice you always know when (time & date) your
this folder. In the form you need not create any componets just
write the code.In form properties make -- Visible -False.
Then create a exe of the project. Keep this exe in 'Startup' folder
of your computer.It will work. Each time your computer is opened
a log record will be kept in the 'log.fil' file.
To view this record go to Ms-dos and run edit on the file 'log.fil'
--------------------------------------------------------------
Code for log keeper:
======
Dim tim As String
Dim yr As String
Dim lng As Integer
Dim rst As String
Dim mnth As String
Dim dt As String
Dim day As String
Dim dystore As String
Dim mnstore As String
Dim mnthval As Integer
Dim totdt As String
Dim txt1, txt2, txt3 As String
Private Sub Form_Load()
tim = Time
dt = Date
lng = Len(dt)
yr = "20" + Right$(dt, 2)
rst = Left$(dt, (lng - 3))
mnth = Left$(dt, 2)
If Right$(mnth, 1) = "/" Then
mnth = Left$(mnth, 1)
End If
day = Right$(rst, 2)
If Left$(day, 1) = "/" Then
day = Right$(day, 1)
End If
mnthval = Val(mnth)
' SELECTING ST/ND/RD/TH AFTER THE DAY
If day = "1" Or day = "31" Then
dystore = day + "st"
Else
If day = "2" Or day = "22" Then
dystore = day + "nd"
Else
If day = "3" Or day = "23" Then
dystore = day + "rd"
Else
dystore = day + "th"
End If
End If
End If
'SELECTING MONTH NAME FROM MONTH NUMBER
If mnthval = 1 Then
mnstore = "January"
End If
If mnthval = 2 Then
mnstore = "February"
End If
If mnthval = 3 Then
mnstore = "March"
End If
If mnthval = 4 Then
mnstore = "April"
End If
If mnthval = 5 Then
mnstore = "May"
End If
If mnthval = 6 Then
mnstore = "June"
End If
If mnthval = 7 Then
mnstore = "July"
End If
If mnthval = 8 Then
mnstore = "August"
End If
If mnthval = 9 Then
mnstore = "September"
End If
If mnthval = 10 Then
mnstore = "October"
End If
If mnthval = 11 Then
mnstore = "November"
End If
If mnthval = 12 Then
mnstore = "December"
End If
' Total Date
totdt = dystore + " " + mnstore + ", " + yr
' Log Storing
Open "C:\Log\log.fil" For Append As #1
Write #1, tim, totdt
Close
End
End Sub
No comments have been posted about This simple program keeps a log record of when your computer is opened. Without any one's notice yo. Why not be the first to post a comment about This simple program keeps a log record of when your computer is opened. Without any one's notice yo.