TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Gary Chambers
from: Peter Fitzsimmons
date: 1996-02-04 04:09:32
subject: WinCreateMsgQueue

GC> Not specifed after a cursory glance at the Messages and Message Queues 
 GC> section.  It does, however, note that the default 
 GC> queue is "usually large enough to hold all input 
 GC> messages even if the user types or moves the mouse 
 GC> very quickly.  If the operating system message queue 
 GC> does run out of space, the system *ignores* the most 
 GC> recent keyboard input (usually by beeping to indicate

This was very naive,  since that is not the only source of messages
--WinPostMsg and WinPostQueueMsg are the other sources.  Many programs use
these apis to post messages amongst their own threads -- and do not check
the return value of WinPostMsg -- so they behave badly when the queue is
full (Borland/Watcom ide's are a good example).

The solution is a larger default queue (fixpak 17 uses 3000) and/or better
programmers.  Here is a simple wrapper for WinPostMsg that will fix the
problem (as long as it is used between threads,  not for posting to the
same thread (which is not often done)):

 /*
  * PostMsg() -- just like WinPostMsg(),  but checks to see
  * if the queue was full
  */
 static void PostMsg(HWND h, ULONG msg, MPARAM mp1, MPARAM mp2)
 {
     while(!WinPostMsg(h, msg, mp1, mp2)){
         DosSleep(1);
     }
 }


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.