?
Solved

make a vb6 program do something every 15 minutes all day

Posted on 2013-11-02
11
Medium Priority
?
411 Views
Last Modified: 2013-11-02
I am trying to make a vb6 prgram check the status of my website every 15 minutes all day long
How can this be done?
0
Comment
Question by:isnoend2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39619079
I would use a Timer control on a form.
Option Explicit
Dim NextTime As Date 
Private Sub Form_Load()
    DoAction
    NextTime = DateAdd("n", 15, Now)
    Timer1.Interval = 60000 'one minute
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If Now >= NextTime Then
        DoAction
        NextTime = DateAdd("n", 15, Now)
    End If
End Sub

Sub DoAction()
'CheckWebsite
'...
End Sub

Open in new window


Note. Post submission edit.  Corrected time unit from "m" (month) to "n" ( minute)
0
 

Author Comment

by:isnoend2001
ID: 39619103
Thanks  GrahamSkan, but that seems to only work one time: On form load
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39619119
Why don't you write a simple program that checks it once and put it in Scheduled Tasks to run every 15 minutes?  That way, you don't have to write the timing part.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39619123
DaveBaldwin's suggestion is another good way of doing the job. However I will try to debug my own VB solution.
0
 

Author Comment

by:isnoend2001
ID: 39619133
Thanks DaveBaldwin, but that would take to writing to Scheduled Tasks, which i know nothing about
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 39619139
Well it worked with the revised (test-only) interval value set to 2
Option Explicit
Dim NextTime As Date
Const intervalminutes = 2
Private Sub Form_Load()
    DoAction
    NextTime = DateAdd("n", intervalminutes, Now)
    Timer1.Interval = 60000 'one minute
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If Now >= NextTime Then
        DoAction
        NextTime = DateAdd("n", intervalminutes, Now)
    End If
End Sub
Sub DoAction()
MsgBox "executing action now"
'CheckWebsite
'...
End Sub

Open in new window

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39619143
You don't need code to schedule tasks, but I'll leave DB to explain how easy it is.
0
 

Author Closing Comment

by:isnoend2001
ID: 39619150
thanks that works
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39619155
Thanks.

I should remember that "m" doesn't always mean "month" in the general consideration of timecode interpretation.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39619188
Scheduled Tasks is in the Windows Control Panel.  Open it up and click on Add Task.  A 'wizard' dialog opens up and you follow the instructions.  On Windows XP, the smallest time interval is an hour though.
0
 

Author Comment

by:isnoend2001
ID: 39619236
Thanks DaveBaldwin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question