|
-
Oct 27th, 2000, 05:01 AM
#1
Thread Starter
Addicted Member
Hi there,
I'm going to build an exe server component that has to be up only once a month, eg the last day of the month.
On this day it will transfer files and write to a database. After it has finished it will have to wait until the next last day of the next month.
Makes any sense?
Well, I'm not sure on how to do this.
My guess is that my exe will need a timer but only respondig every 24 hours and then asking if it is the last day of the month. How do I build such a timer?
Is there another way to do this?
Another thing, if the server is restarted, I would like the exe to also start again.
Please help,
Cheers,
André
-
Oct 27th, 2000, 06:14 AM
#2
_______
<?>
Add a timer to your form Timer1
Code:
'this should work
Option Explicit
Public sDone As Boolean 'marker for the last day finished
sDone = False
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 60000 'approx 1 min.
End Sub
Private Sub Timer1_Timer()
'get last day of the mont
Dim theLast
theLast = Day(DateSerial(Year(Date), Month(Date) + 1, 0))
'check it against today and act accordingly
If Format(Now, "dd") = theLast And sDone = False Then
'do your file stuff
'mark it as done to avoid doing it again
sDone = True
End If
'reset to false after monthend
If Format(Now, "DD") + 1 > theLast Then sDone = False
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 27th, 2000, 07:20 AM
#3
Thread Starter
Addicted Member
Thanx,
Since VB timer approx. can only handle 65 seconds I did'nt want to use it. You know every minute in a month.
I have found an API SetTimer, wich is a callback function that can callback as far as 23 days!!!
So now I can almost wait an entire month almost!
André
-
Oct 27th, 2000, 07:35 AM
#4
_______
<?>
true enough, and if you refreshed your system daily you wouldn't need a timer, you could just store the variable with SaveSettings and check against it each day as you open and if a match then do your stuff.
Later.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|