Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^5: Win32::GUI sending Windows messages between threadsby BrowserUk (Patriarch) |
on Jan 17, 2013 at 20:07 UTC ( [id://1013876]=note: print w/replies, xml ) | Need Help?? |
The problem is that you are tryiong to hook into a system/module defined API without understanding the rules and requirements of that API. Each window can have multiple timers associated with it. This, when the timer triggers and it sends the WM_TIMER message, it *must* also send some additional information as a part of that message that identifies which timer routine should be invoked to handle it. This is easily demonstrated by the following modification of your code which sets up two independent timers for the main window::
Which when run produces the following output:
That suggests the possibility that the (Win32::GUI defined) window procedure arranges for the system defined timer to include a numerical 'timer id' as a part of the WM_TIMER message. It then looks up that id in the -timers hash associated with the target window to obtain the name of the blessed timer object, and then uses that to obtain the information passed onto the -onTimer callback routine. I've tried passing various combinations of id and name on the SendMessage WM_TIMER caller, but have yet to find the correct combination to allow me to trigger tha callback. I suspect that if you dug around in the Win32::GUI sources -- the only reliable documentation I have found for that module -- you might be able to discover the correct magic to allow you to manually trigger the callback, but sending a bare WM_TIMER will not do it. And is not intended to do so. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|