?
Solved

Create a Timer To Run In the Background

Posted on 2003-03-18
5
Medium Priority
?
155 Views
Last Modified: 2010-05-03
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
Comment
Question by:InHuman
[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
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
hmadhur earned 240 total points
ID: 8157733
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
 
LVL 1

Expert Comment

by:hmadhur
ID: 8157739
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
 
LVL 6

Expert Comment

by:PlanetCpp
ID: 8157741
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
 

Author Comment

by:InHuman
ID: 8158576
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
 
LVL 1

Expert Comment

by:hmadhur
ID: 8158683
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month14 days, 6 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