Changeset 2246 for trunk/src


Ignore:
Timestamp:
Dec 29, 1999, 1:39:45 PM (26 years ago)
Author:
sandervl
Message:

PostThreadMessage fix

Location:
trunk/src/user32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r2202 r2246  
    1 # $Id: Makefile,v 1.52 1999-12-24 21:44:04 sandervl Exp $
     1# $Id: Makefile,v 1.53 1999-12-29 12:39:43 sandervl Exp $
    22
    33#
     
    129129pmframe.obj: pmframe.cpp win32class.h win32wbase.h pmframe.h win32wndchild.h
    130130win32class.obj: win32class.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h $(PDWIN32_INCLUDE)\win\winproc.h
    131 win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h controls.h winmouse.h $(PDWIN32_INCLUDE)\win\winproc.h $(PDWIN32_INCLUDE)\win\hook.h
     131win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h controls.h winmouse.h $(PDWIN32_INCLUDE)\win\winproc.h $(PDWIN32_INCLUDE)\win\hook.h oslibmsg.h
    132132win32wbasepos.obj: win32wbasepos.cpp win32class.h win32wbase.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h win32wdesktop.h
    133133win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h $(PDWIN32_INCLUDE)\heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
  • trunk/src/user32/oslibmsg.cpp

    r2208 r2246  
    1 /* $Id: oslibmsg.cpp,v 1.16 1999-12-27 14:41:41 sandervl Exp $ */
     1/* $Id: oslibmsg.cpp,v 1.17 1999-12-29 12:39:44 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    366366//******************************************************************************
    367367//******************************************************************************
     368BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
     369{
     370  return WinPostMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
     371}
     372//******************************************************************************
     373//******************************************************************************
     374ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
     375{
     376  return (ULONG)WinSendMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
     377}
     378//******************************************************************************
     379//******************************************************************************
     380ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend)
     381{
     382  return WinBroadcastMsg(HWND_DESKTOP, msg, (MPARAM)wParam, (MPARAM)lParam,
     383                         (fSend) ? BMSG_SEND : BMSG_POST);
     384}
     385//******************************************************************************
     386//******************************************************************************
     387BOOL OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam)
     388{
     389 THDB *thdb = GetTHDBFromThreadId(threadid);
     390
     391    if(thdb == NULL) {
     392        dprintf(("OSLibPostThreadMessage: thread %x not found!", threadid));
     393        return FALSE;
     394    }
     395    return WinPostQueueMsg(thdb->hmq, msg, (MPARAM)wParam, (MPARAM)lParam);
     396}
     397//******************************************************************************
     398//******************************************************************************
     399
  • trunk/src/user32/oslibmsg.h

    r2208 r2246  
    1 /* $Id: oslibmsg.h,v 1.8 1999-12-27 14:41:42 sandervl Exp $ */
     1/* $Id: oslibmsg.h,v 1.9 1999-12-29 12:39:44 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    4242BOOL  OSLibWinReplyMessage(ULONG result);
    4343ULONG OSLibWinQueryQueueStatus();
     44
     45BOOL  OSLibPostThreadMessage(ULONG threadid, UINT msg, WPARAM wParam, LPARAM lParam);
     46BOOL  OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
     47ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
     48ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend);
    4449
    4550#define WINWM_NULL                  0x0000
  • trunk/src/user32/oslibmsgtranslate.cpp

    r2208 r2246  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.3 1999-12-27 14:41:42 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.4 1999-12-29 12:39:44 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    112112  memset(winMsg, 0, sizeof(MSG));
    113113  win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd);
    114   if((win32wnd == 0 && os2Msg->msg != WM_CREATE))
     114  //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle
     115  if((win32wnd == 0 && os2Msg->msg != WM_CREATE && os2Msg->msg != WIN32APP_POSTMSG))
    115116  {
    116117        goto dummymessage; //not a win32 client window
     
    131132            winMsg->wParam  = packet->wParam;
    132133            winMsg->lParam  = packet->lParam;
     134            if(win32wnd == NULL) {
     135                free(packet); //messages posted by PostThreadMessage are never dispatched, so free the memory here
     136            }
    133137            break;
    134138        }
  • trunk/src/user32/oslibwin.cpp

    r2221 r2246  
    1 /* $Id: oslibwin.cpp,v 1.54 1999-12-27 22:53:53 cbratschi Exp $ */
     1/* $Id: oslibwin.cpp,v 1.55 1999-12-29 12:39:44 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    248248
    249249  return WinQueryWindowULong(hwnd, offset);
    250 }
    251 //******************************************************************************
    252 //******************************************************************************
    253 BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
    254 {
    255   return WinPostMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
    256 }
    257 //******************************************************************************
    258 //******************************************************************************
    259 ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
    260 {
    261   return (ULONG)WinSendMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
    262 }
    263 //******************************************************************************
    264 //******************************************************************************
    265 ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend)
    266 {
    267   return WinBroadcastMsg(HWND_DESKTOP, msg, (MPARAM)wParam, (MPARAM)lParam,
    268                          (fSend) ? BMSG_SEND : BMSG_POST);
    269250}
    270251//******************************************************************************
  • trunk/src/user32/oslibwin.h

    r2211 r2246  
    1 /* $Id: oslibwin.h,v 1.29 1999-12-27 17:08:08 cbratschi Exp $ */
     1/* $Id: oslibwin.h,v 1.30 1999-12-29 12:39:44 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    4949ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset);
    5050BOOL  OSLibSetWindowID(HWND hwnd, ULONG value);
    51 
    52 BOOL  OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
    53 ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam);
    54 ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend);
    5551
    5652#define WAOS_WARNING                 0
  • trunk/src/user32/win32wbase.cpp

    r2221 r2246  
    1 /* $Id: win32wbase.cpp,v 1.122 1999-12-27 22:53:53 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.123 1999-12-29 12:39:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    2828#include "wndmsg.h"
    2929#include "oslibwin.h"
     30#include "oslibmsg.h"
    3031#include "oslibutil.h"
    3132#include "oslibgdi.h"
     
    657658  else
    658659  if (windowClass->getStyle() & CS_PARENTDC)  {
    659     dprintf(("ERROR: Class with CS_PARENTDC style -> NOT IMPLEMENTED!"));
     660    dprintf(("WARNING: Class with CS_PARENTDC style!"));
    660661    fParentDC = TRUE;
    661662    ownDC = 0;
     
    663664  else
    664665  if (windowClass->getStyle() & CS_CLASSDC)  {
    665     dprintf(("ERROR: Class with CS_CLASSDC style -> NOT IMPLEMENTED!"));
     666    dprintf(("WARNING: Class with CS_CLASSDC style!"));
    666667    ownDC = 0;
    667668  }
     
    21542155 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    21552156
     2157    dprintf(("PostThreadMessageA %x %x %x %x", threadid, msg, wParam, lParam));
    21562158    packet->Msg = msg;
    21572159    packet->wParam = wParam;
    21582160    packet->lParam = lParam;
    21592161    packet->fUnicode = FALSE;
    2160     return O32_PostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
     2162    return OSLibPostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (LPARAM)packet);
    21612163}
    21622164//******************************************************************************
     
    21662168 POSTMSG_PACKET *packet = (POSTMSG_PACKET *)_smalloc(sizeof(POSTMSG_PACKET));
    21672169
     2170    dprintf(("PostThreadMessageW %x %x %x %x", threadid, msg, wParam, lParam));
    21682171    packet->Msg = msg;
    21692172    packet->wParam = wParam;
    21702173    packet->lParam = lParam;
    21712174    packet->fUnicode = TRUE;
    2172     return O32_PostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (DWORD)packet);
     2175    return OSLibPostThreadMessage(threadid, WIN32APP_POSTMSG, WIN32PM_MAGIC, (LPARAM)packet);
    21732176}
    21742177//******************************************************************************
  • trunk/src/user32/windowmsg.cpp

    r2208 r2246  
    1 /* $Id: windowmsg.cpp,v 1.13 1999-12-27 14:41:43 sandervl Exp $ */
     1/* $Id: windowmsg.cpp,v 1.14 1999-12-29 12:39:45 sandervl Exp $ */
    22/*
    33 * Win32 window message APIs for OS/2
     
    226226BOOL WIN32API PostThreadMessageA( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
    227227{
    228     dprintf(("USER32:  PostThreadMessageA\n"));
    229228    return Win32BaseWindow::PostThreadMessageA(threadid, msg, wParam, lParam);
    230229}
     
    233232BOOL WIN32API PostThreadMessageW( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
    234233{
    235     dprintf(("USER32:  PostThreadMessageW\n"));
    236234    return Win32BaseWindow::PostThreadMessageW(threadid, msg, wParam, lParam);
    237235}
Note: See TracChangeset for help on using the changeset viewer.