quote:
Originally posted by raceprouk
If you're worried about a message loop, don't be. So long as you call SetTimer() in the same thread as Initialize(), Messenger's own message loop will handle dispatching the timer messages.
For that it doesn't nessecairly need to be in the Initialize() function though. You can put it in whatever procedure, as long as SetTimer() is executed somewhere within the plugin (and TimerProc() is available to the outside world)...
(eg: if you want to start the timer only when a command is parsed, you only need to put it in the ParseCommand() function).
quote:
Originally posted by Itsme-HcK
Added to this queue are also clicks with the mouse, actions, menu's, the whole crap. You have to parse those messages, so you can handle them. So, when you do that, the timer function will be called, resulting in a call to my function.
You are confusing stuff and making it harder than it is. You do not need to parse any windows messages (unless you're in your own dialog screen or are subclassing or whatever). Windows messages are almost always handled by the owners, in this case that would be Messenger itself. In case for a timer countdown, that is handled by Windows if you use a callback function.
All can be found in the MSDN Library. (Or if you only had tried out Raceprouk's example in his very first reply)
quote:
Originally posted by Itsme-HcK
But, if the user doesn't send messages to buddies for say, 15 minutes, my plug-in isn't called the whole time. So isn't my function.
It is your function, as it is a callback function which you have set as a parameter when you set the timer.
Timer messages are handled by Windows when you use a callback function, as you can read on the MSDN pages, and when they trigger they call that given function in your program back (hence callback function).
quote:
Originally posted by Itsme-HcK
Then why the hell didn't you just SAY SO?
Howevers, then that's it.
Thank y00, for as far as it did come.
tbh, everything was already said from the very first replies, then it got a bit vague (because you didn't say what you meant with "messages" and it is so inlogical that you meant windows messages), but after that, again the people already said all this in their replies...
It is clearly explained and shown on the MSDN library help page for timers, linked to by raceprouk.
quote:
An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER.
and there is even a full working examples given.