TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: Mark Kimes
date: 1996-02-08 23:03:58
subject: Re: WinCreateMsgQueue

PF> Here is a simple wrapper for WinPostMsg that will fix the problem
 PF> (as long as it is used between threads,  not for posting to the
 PF> same thread (which is not often done)):

 BOOL PostMsg (HWND h, ULONG msg, MPARAM mp1, MPARAM mp2) {

   BOOL rc = WinPostMsg(h,msg,mp1,mp2);

   if(!rc) {

     PIB *ppib;
     TIB *ptib;

     if(!DosGetInfoBlocks(&ppib,&ptib)) {

       PID pid;
       TID tid;

       if(WinQueryWindowProcess(h,&pid,&tid)) {
         if(pid != ppib->pib_ulpid || tid != ptib->tib_ptib2->tib2_ultid) {
           for(;;) {
             DosSleep(1L);
             rc = WinPostMsg(h,msg,mp1,mp2);
             if(!rc) {
               if(!WinIsWindow((HAB)0,h)) /* undocumented but seems to work */
                 break;
             }
             else
               break;
           }
         }
       }
     }
   }
   return rc;
 }

--- XHEd-OS/2 1.22
* Origin: The Pit (1:380/16)
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: 380/25 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™.