views:

357

answers:

1

Hi I am new to VC++ .net programming. Please help me out how to use System.Threading.Timer in a windows service VC++ .net code. I tried using form.timer and system.timer class but as it turns out it's a known windows bug and it won't work reliably. I am not able to use system.threading.timers. Please give an example.

Nitin

+1  A: 

As AndrewS mentioned, MSDN usually has good starter examples. You can check this out and scroll down to the Examples section under the Visual C++ section to see the System.Threading.Timer example.

SwDevMan81
Yes I googled and that too a LOT. OK I delve out the issues. The Timer class by Microsoft has issues and is a known MS bug http://support.microsoft.com/kb/842793Microsoft suggests using System.threading.timer instead of System.Timer.Timer (wrapper class) or System.Forms.Timer(doesn't work for windows services). However, I am not able to use System.Threading.Timer in VC++ .net, not sure what I am not doing wrong (I used MSDN examples for help) but it just doesn't work. System.Timer.timer class was unreliable but threading.timer doesn't even work for me. So I wanted some working examples.
The examples supplied on the MSDN page will work. You should post your code that doesnt work s0 we can figure out whats wrong with it.
SwDevMan81