Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

Create a Timer To Run In the Background

Hi, I'm developing a reminder software using visual basic 6 to remind the user of a message on a certain date and time. The user gets to set a certain time and date and message. I calculated the difference between the current date and time and the date and time which was set and converted it to seconds. Then i pass it to Call Starttimer(seconds) . The timer starts and displays the message after the certain seconds.

I used timer apis (settimer and killtimer). I realised the timer api doesn't run when the PC is shutdown or when the program is not running. Is there anyway that i can implement a timer which runs in the "background" even when the PC is shutdown? Pardon me for any mistakes in my question.
Thanks

Humanity.

0
InHuman
Asked:
InHuman
  • 3
1 Solution
 
hmadhurCommented:
Hi,
I was also involved in creating a calendar with appointments and reminders.

What I did was I created another small application that would rest in the tray as an icon. All the appointments would be stored in the Database (SQL for my app). Every 2 mins I would check if any reminder has been set(You can set it to any amount of time). If there was, I would display a dialog giving him the options for snoozing the timer for next 10 mins or to discard the reminder. This way, the main Big application need not be running and the timer app will be a very small application checking for any reminders.

The technique you are using, as you said, will not work when you switch off the machine. And I think there is not way to execute any application in the background or foreground when the machine is switched off. The better option is to store the data and time and message in a database.

Hope this helps.

Good Luck

Madhur
0
 
hmadhurCommented:
Hi,
I was also involved in creating a calendar with appointments and reminders.

What I did was I created another small application that would rest in the tray as an icon. All the appointments would be stored in the Database (SQL for my app). Every 2 mins I would check if any reminder has been set(You can set it to any amount of time). If there was, I would display a dialog giving him the options for snoozing the timer for next 10 mins or to discard the reminder. This way, the main Big application need not be running and the timer app will be a very small application checking for any reminders.

The technique you are using, as you said, will not work when you switch off the machine. And I think there is not way to execute any application in the background or foreground when the machine is switched off. The better option is to store the data and time and message in a database.

Hope this helps.

Good Luck

Madhur
0
 
PlanetCppCommented:
it's your program you have to have it wait. you have to have it run in the background. there's exceptions of course if you want to have windows perform some task or run a program at a specified time then you can add it to the scheduled tasks through the program. i never actually seen code to do that im sure theres some api for it.
but for what you need you're going to have to have your program wait. you can add it to the system tray and hide it..
0
 
InHumanAuthor Commented:
Thanks Madhur for your idea. I think thats a great idea. I've tried it and it works well. Planet, thanks for your comment as well.

Humanity
0
 
hmadhurCommented:
You are most welcome Mr.Humanity.

You know this is my first accepted answer. I joined this site 2 years before and was only asking or viewing questions. I considered myself fit to be registered as an expert just two days back. I got myself registered as an expert on 15/16th March. And you were the first person to accept my answer.

Thanks and Regards
Madhur
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now