deltatz Posted June 23, 2006 Share Posted June 23, 2006 Guys i need help here,my project is design a time table program for schools.the idea behind is that the program should sound an alarm each time class periods ends which i dont have a problem up to that point.im fluent with Visual Basic.My problem is i want to make the program run on the machine while the machine is running other program such as msword,excel etc.in other words when the time for the alarm to sound comes there should be a machanism to interapt the current running program,serve the alarm and return back to the interapted program without the user noticing anything.that is to say it should run stealthly.Im desparate for the tips guys.Please help,thanks in advance Link to comment Share on other sites More sharing options...
phkninja Posted June 23, 2006 Share Posted June 23, 2006 why does it have to inerupt. If i were implementing this and wanted to keep it simple, i would have a txt file for the timetable. The program runs agauinst the timetable, has a delay for each period (can be a while loop whith a no op inside), after trhe delay(make the delay 1 minute shorter than alarm period) check the current time and checks against the timetable and dispalys it in the progam window. Then when the alarm sounds the user can click on the window to see what subject is displayed. That way they can ignore the alrm until they want tro read it.It would be less hastle then trying to implement the inetrupts, or to ensure he program is the one in focus when the alarm sounds. Link to comment Share on other sites More sharing options...
LLXX Posted June 23, 2006 Share Posted June 23, 2006 (edited) ...why do you even need to write your own program?Just use the Windows Task Scheduler service.The program runs agauinst the timetable, has a delay for each period (can be a while loop whith a no op inside),Looping infinitely is not a good solution in a multitasking OS environment. Better to use the sleep() system call to relinquish the CPU and allow the scheduler to switch to another process, rather than have your timing process waste CPU cycles until its timeslice is exhausted. Edited June 23, 2006 by LLXX Link to comment Share on other sites More sharing options...
phkninja Posted June 25, 2006 Share Posted June 25, 2006 LLXX- i agree with your comment on the loop function but it was only an example. Also i didnt know the sleep() function was platform independant. If is works on all oses then its handy to have Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now