Manually invoke a timer time-up event?

I have a timer that I'm using in my winforms application. I was wondering is there a way to manually invoke the timer time-up event by not actually waiting for the timer to expire? I need to have the timer up event code executed in my application at one point.

private: System::Void timeup(System::Object^ sender, System::EventArgs^ e) {

}

Is there a way?

Thanks!!

[492 byte] By [Boulderdude] at [2007-12-24]
# 1

hi

Firstly, I want to simply use SendMessage for a WM_TIMER message when you want to fire a timer event.

After dry up all possible ways, I can't get the timer id and callback funtion pointer.

However, the timer event is quite simple in .NET Framework, you can implement your own "timer object" by win32 api

Here is a reference may help you

http://www.codeproject.com/csharp/ftwin32timers.asp

gqlu at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

Can you just create a separate method for the piece of code that you want to reuse for both timer Timeup event and programmatic initiation?

JRQ at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
Yeah, thats how I worked around this problem. Moved the timer-up code to a separate method and i'm just calling that method when required.
Boulderdude at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
It's also possible to just call the Timeup method directly. Even though it's an event handler it's still legal (and sometimes practicle) to just call it directly.
JaredParsonsMSFT at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 5
Interesting. Didnt know that. Thanks for the information.
Boulderdude at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 6
What about its arguments?
Boulderdude at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 7
For the arguments pass in whatever is relevant to the method. Often times when I'm handling events like Timer I don't need the arguments at all. So if I call the method manually I just pass in Nothing,Nothing.
JaredParsonsMSFT at 2007-10-8 > top of Msdn Tech,Windows Forms,Windows Forms General...