Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Win32::GUI sending Windows messages between threads

by BrowserUk (Pope)
on Jan 17, 2013 at 15:44 UTC ( #1013803=note: print w/ replies, xml ) Need Help??


in reply to Win32::GUI sending Windows messages between threads [solved]

Use PostMessage() instead of SendMessage() and see how you fare?


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.


Comment on Re: Win32::GUI sending Windows messages between threads
Re^2: Win32::GUI sending Windows messages between threads
by shadrack (Acolyte) on Jan 17, 2013 at 17:00 UTC
    Same result with Postmessage (nothing happens).

    A quick Google indicates the only difference between PostMessage and SendMessage is that PostMessage returns immediately while SendMessage waits for the recipient to process the message.

    Anyway, I tried it. No difference.

      A quick Google indicates the only difference between PostMessage and SendMessage is that PostMessage returns immediately while SendMessage waits for the recipient to process the message.

      You are correct, but you have missed the significance.

      1. SendMessage is a synchronous call.

        If the timer handler -- your custom function -- takes a long time to run, it will cause your GUI to freeze until it is finished.

      2. PostMessage() is an asynchronous call;

        The message is added to the queue and processed when it reaches the top. This allowing the originator of the message to do other things during the interim.


      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.
        My point was that the difference did not seem to be relevant to the fundamental problem that nothing seems to happen when I call SendMessage(). As I said, I tried it and nothing happened with PostMessage() either. If neither solves my problem, the difference is academic.

        ... or am I missing something?

        I can't seem to reply to your last message for some reason, but I am aware of the timer ID issue and I did try several different values for wParam and lParam even before my initial post. None of them seemed to be any more effective than using 0, 0, and some even blew up perl, so I left them out of the example. Anyway, I solved the problem by using a different message all together (WM_USER) as is (now) detailed in the OP. Thx.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013803]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-09-22 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls