Re: The basics of Windows' messages




Ney André de Mello Zunino a écrit :

<snip>

If no special measure is taken, the consequences are anything but nice.
As mentioned in your response, if an application does not process
messages timely, it will appear to be hung; in other words, it will not
be responding to the user's input, requests for repainting by the
system, etc.

The two workarounds for this situation which I know are:

1) write the lengthy processing as a separate thread; or
2) force the application to periodically deal with its message queue.

I would like to focus on item 2) for now.

William as already answered your questions about 2) in great details,
but I would like to add that most experienced developers consider 2) to
be a bad choice, and 1) to be the correct solution.

The main reason for that is that, if you follow the 2) way, you need to
add calls to ProcessMessages/DoEvents/PeekMessage loop inside your
lengthy processing code, which is an anathem from an encapsulation
point of view, and is never an ideal solution. Among other things, how
often you must run the PeekMessage loop in order to keep the UI
responsive enough for the user depends on the lengthy treatment, but
also on the speed of the target machine.

Arnaud
MVP - VC

.



Relevant Pages

  • Re: memory leak (definition?)
    ... >> The correct solution is to understand the SW you are using and how to ... >> code than the code you are calling. ... to Gordon Burditt's response, is whether the exec family of functions ... such as the exec family are in fact relevant to the language and ...
    (comp.lang.c)
  • Re: Clearing objects in a VBProject
    ... Thanks for your perserverance - I am looking for the correct solution. ... I didn't look closely enough to your response to notice that you were using ... "Tom Ogilvy" wrote: ... >> process in TaskManager. ...
    (microsoft.public.excel.programming)
  • Re: The basics of Windows messages
    ... but I would like to add that most experienced developers consider 2) to ... and 1) to be the correct solution. ... The reason I focused my question on option 2) is that I wish to understand the execution flow from the point amid the lengthy process, where /ProcessMessages/ is called, to the queue processing, and then back to the calling site, where the lengthy process is resumed. ... William's response has already taken me much closer in that direction, but I think I might still need another round. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Baroque Revival
    ... were warned there might be that type of response. ... just as much of a fallacy in composing something "modern" just to make it ...
    (rec.music.compose)
  • Re: FMA - episode 36 - The Sinner Within
    ... >> To protect the innocence of the younger brother? ... >>> Winry very formally starts to ask Riza a question and Riza tells her ... Certainly not the "yes, many" response that you ...
    (rec.arts.anime.misc)