|
-
Jan 21st, 2013, 04:42 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] What timer to use.
I am writing a new project tonight I thought I may have a go at writing a program to close process, for example when Notepad.exe is opened, it will inform the user to enter a password if correct run app else close it, well simple
I was just wondering should I go with for checking the process I thought of a normal timer, but I am unsure someone said to me maybe use threading
I not had much experience on threading so I don’t know were to start on that. also I herd VB.NET has 3 timers a normal one a server one and a threading one.
what one do you think will be the best to use for my app, Remember it be running in the background all the time.
Thanks
-
Jan 21st, 2013, 06:20 PM
#2
-
Jan 21st, 2013, 07:18 PM
#3
Thread Starter
Fanatic Member
Re: What timer to use.
wow that a lot of reading to do tho went down to the bottom of the page the System.Threading.Timer seems a good one to look into.
Anyway we see how my app turns out thanks for the link I Bookmark it for latter reading.
-
Jan 21st, 2013, 07:30 PM
#4
Re: What timer to use.
 Originally Posted by BenJones
wow that a lot of reading to do
That's how you learn, reading enough information to get the full picture instead of asking for specific answers to specific questions that provide no real understanding outside a very specific set of circumstances.
As for the right Timer, it's rare that you should have to use a Threading.Timer. The Timers.Timer is a wrapper for that anyway so, unless you specifically need a very lightweight Timer, don't use a Threading.Timer. As the name suggests, the Windows.Forms.Timer is intended for use in WinForms apps. It raises its Tick event on the UI thread. The Timers.Timer can also raise its Elapsed event on the UI thread in a WinForms app but, by default, it will raise events on a thread pool thread, which means that multiple event handlers can execute simultaneously and other work can be done at the same time too.
-
Jan 22nd, 2013, 05:15 AM
#5
Thread Starter
Fanatic Member
Re: What timer to use.
 Originally Posted by jmcilhinney
That's how you learn, reading enough information to get the full picture instead of asking for specific answers to specific questions that provide no real understanding outside a very specific set of circumstances.
As for the right Timer, it's rare that you should have to use a Threading.Timer. The Timers.Timer is a wrapper for that anyway so, unless you specifically need a very lightweight Timer, don't use a Threading.Timer. As the name suggests, the Windows.Forms.Timer is intended for use in WinForms apps. It raises its Tick event on the UI thread. The Timers.Timer can also raise its Elapsed event on the UI thread in a WinForms app but, by default, it will raise events on a thread pool thread, which means that multiple event handlers can execute simultaneously and other work can be done at the same time too.
Yes it was a lot of reading some went over my head and it was late , I am just used to the old VB6 one timer, now we have 3, anyway thanks for the info I try it out.
Last edited by BenJones; Jan 22nd, 2013 at 05:25 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|