I have an aplications that need to be running at all times within this application there is a process that needs to start at a certain time. I have tried using the time with in vb.net windows forms but if I had to put the application on to check every minute the the program will use to much of the user's pc memory. The program is suppossed to be non invasive. I was wondering if there is any other way to check for times that don't affect the pc to much.
Timer Problems with vb.net
Collapse
X
-
I did not actually understand what problems you are having - if you are asking how to start another application from your app, you should use something like:which should be placed in your Timer's event handler, with Timer.Interval set to 60000 ms.Code:System.Diagnostics.Process.Start("some_path\other_app.exe")
This will start your other app, which should close itself when it's done. This other app will use some memory, but if you need the job done, I guess it is up to you to write the simplest possible program which does what you need.
The other thing that might be concerning you is that your Timer app by itself probably uses ~20Mb of your memory, because it is running under .NET CLR. There is no cure for that :) - the only option to get rid of .NET is to use native C++.
On the other hand, if you're doing this for home use and need to do some simple file handling, why don't you just use Windows' task scheduler and add a repetitive task for some batch or cmd file? -
if in vb.net, why not use some of the my.computer.clo ck methods/functions ? like start a thread, set its .background property to true, and in the thread either make a timer that checks the time every 1000 ms, or something, or do a "Do" statement, like
Code:Do Until My.Computer.Clock.LocalTime.Hour = 8 Threading.Thread.Sleep(100) Loop Do Until My.Computer.Clock.LocalTime.Minute = 55 Threading.Thread.Sleep(500) Loop Process.Start("MYPROCESS") 'replace with process you want, because once the hour is right, it waits for the minute to be right, then it will start the process, did this help? and make sure its running background on a new thread started from your main form...Comment
Comment