Board index » delphi » OnMessage problem...

OnMessage problem...

Hey everybody...

        I've installed my own Application.OnMessage handler in my app
so that when I'm doing some socket communication, the user can't hit
buttons or anything in my program and get things out of whack. My
problem is, however, that while I'm waiting for information to come
back from the socket my app is processing messages WITHOUT calling my
OnMessage handler. Anybody experience this before?

        Here's some more detail...

        In my code, when the user hits a button, I call a function to
change the cursor to an hourclass, then set a flag called
'processing'. Then I do the response to the user's button press (like
loading something up over the socket), then I reset the 'processing'
flag.

        My OnMessage handler looks like this:

if processing then
        case Msg.message of
                WM_LBUTTONDOWN: handled := true;
                WM_LBUTTONUP: handled := true;
        end;

        So, basically, the user's actions won't have any effect until
I reset the processing flag.

        This seems to work fine for normal stuff, but if I perform a
blocking socket read or write, button press messages are being
processed and my OnMessage handler isn't being called.

        What's up with this? Anybody see this before? Eck! I'm dying!

Eric...

 

Re:OnMessage problem...


In article <DLLHMH....@ennews.eas.asu.edu>
           lambr...@enuxsa.eas.asu.edu "Eric Lambrecht" writes:

Quote
>         I've installed my own Application.OnMessage handler in my app
> so that when I'm doing some socket communication, the user can't hit
> buttons or anything in my program and get things out of whack. My
> problem is, however, that while I'm waiting for information to come
> back from the socket my app is processing messages WITHOUT calling my
> OnMessage handler. Anybody experience this before?

Eric

It sounds as though your program waits without looping on
application.processMessages.  If you loop in this way it will provide
the means for you onMessage handler to get a look in.

--
regards

Dave Gray                                 Nailsea Bristol UK 01275 857746
Bespoke Engineering & Technical Software       da...@davegray.demon.co.uk

Other Threads