-
date of last run
Can anyone tell me how to call the date and time of the last time a vb5 exe has been run? What I have is an exe project that copies a file from one dir to another(this is how i am backing a project up) but what i want is to print on the form when it is opened the date and time that it was last run.
Thanks in advance for any help in this matter
-
Re: date of last run
Wouldn't it just be the date of the file in the new directory? Is there a chance that "backup" could be written over by another application?
CodeHacker
Rate me if it helped, Thanks
-
Re: date of last run
'what about writing and reading it in a small txt file (or in registry with
'savesetting,...)?
'ie:
option Explicit
private Sub Form_Load()
Dim lastD
If Dir("lstrun.txt") = "" then
Open "lstRun.txt" for Output as #1
print #1, date
Close #1
End If
Open "lstRun.txt" for input as #1
Line input #1, lastD
Close #1
me.Caption = lastD
End Sub
private Sub Form_Unload(Cancel as Integer)
Open "lstRun.txt" for Output as #1
print #1, date
Close #1
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
-
Re: date of last run
i have tried to make it as simple as possible and all i want is to have the date and time that it was last run printed on the form so that i can see when it was last run when i open the program
Thanks in advance for any help in this matter
-
Re: date of last run
Try this...
private Sub Form_Load()
me.Caption = GetSetting(App.Title, "Settings", "LastRun", "")
End Sub
private Sub Form_Unload(Cancel as Integer)
SaveSetting App.Title, "Settings", "LastRun", Now()
End Sub
(You'll have to run it twice since the first time the time/date hasn't been saved yet.)
-
Re: date of last run
The filesystemobject has a date last assessed property. Will that work? I know that it is not a date last run because this property will be updated if someone tried to open the exe with notepad etc., but it is as close as you're gonna get without using the procedures as already described in the previous posts.
David Paulson