home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cenvi23.zip / WINMSG.LIB < prev    next >
Text File  |  1995-03-28  |  3KB  |  82 lines

  1. // WinMsg.lib - Functions for WinPostMsg(), WinSendMsg() and related
  2. // ver.2
  3. //
  4. //**** WinSendMsg(): Send a message to a window handle
  5. // SYNTAX: int WinSendMsg(int WindowHandle,int MessageID,int Param1,int Param2)
  6. // WHERE: WindowHandle: any PM window handle
  7. //        MessageID; unique message identifier - often a WM_xxx message
  8. //        Param1, Param2: input parameters with meaning depending on MessageID
  9. // RETURN: Returns value returned by window's message function
  10. //
  11. //
  12. //**** WinPostMsg(): Post a message to a window handle
  13. // SYNTAX: bool WinPostMsg(int WindowHandle,int MessageID,int Param1,int Param2
  14. //                         [,bool MustPostFromPM])
  15. // WHERE: WindowHandle: any PM window handle
  16. //        MessageID; unique message identifier - often a WM_xxx message
  17. //        Param1, Param2: input parameters with meaning depending on MessageID
  18. //        MustPostFromPM: If False then can post from CEnvi2 without CEnvi2PM; default False
  19. // RETURN: boolean TRUE if able to post, else boolean FALSE
  20. //
  21. //
  22. //**** WinBroadcastMsg(): Broadcast a message to all windows
  23. // SYNTAX: bool WinBroadcastMsg(int ParentWinHandle,int MessageID,
  24. //                              int Param1,int Param2,int Command)
  25. // WHERE: ParentWinHandle: any PM window handle; will broadcast to children of this window
  26. //        MessageID; unique message identifier - often a WM_xxx message
  27. //        Param1, Param2: input parameters with meaning depending on MessageID
  28. //        Command: Broadcast message command, bitwise OR of following
  29.    #define BMSG_POST          0
  30.    #define BMSG_SEND          1
  31.    #define BMSG_POSTQUEUE     2
  32.    #define BMSG_DESCENDANTS   4
  33.    #define BMSG_FRAMEONLY     8
  34. // NOTE: BMSG_POST, BMSG_SEND, and BMSG_POSTQUEUE or mutually exclusive
  35. // RETURN: boolean TRUE if able to post or send to all, else boolean FALSE
  36. //
  37. //
  38. //**** MakeLongFromShorts(): combine two shorts (16-bit) into a long (32-bit)
  39. // SYNTAX: int MakeLongFromShorts(LowShort,HighShort)
  40. // WHERE: LowShort, HighShort: two 16-bit values
  41. // RETURN: Return integer (low | high << 16)
  42. //
  43. //
  44. //**** MakeShortFromBytes(): combine two bytes (8-bit) into a Short (16-bit)
  45. // SYNTAX: int MakeShortFromBytes(LowByte,HighByte)
  46. // WHERE: LowByte, HighByte: two 8-bit values
  47. // RETURN: Return integer (low | high << 8)
  48. //
  49. //
  50.  
  51. WinSendMsg(pHwnd,pMsg,pParam1,pParam2)
  52. {
  53.    #define ORD_WIN32SENDMSG   920
  54.    return PMDynamicLink("PMWIN",ORD_WIN32SENDMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
  55. }
  56.  
  57. WinPostMsg(pHwnd,pMsg,pParam1,pParam2,pMustPostFromPM)
  58. {
  59.    #define ORD_WIN32POSTMSG   919
  60.    return ( va_arg() < 5 ||  !pMustPostFromPM )
  61.         ? DynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2)
  62.         : PMDynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
  63. }
  64.  
  65. WinBroadcastMsg(pParent,pMsg,pParam1,pParam2,pCmd)
  66. {
  67.    #define ORD_WIN32BROADCASTMSG 901
  68.    return PMDynamicLink("PMWIN",ORD_WIN32BROADCASTMSG,BIT32,CDECL,
  69.                         pParent,pMsg,pParam1,pParam2,pCmd);
  70. }
  71.  
  72. MakeLongFromShorts(pLo,pHi)
  73. {
  74.    return ( (pLo & 0xFFFF) | ((pHi & 0xFFFF) << 16) );
  75. }
  76.  
  77. MakeShortFromBytes(pLo,pHi)
  78. {
  79.    return ( (pLo & 0xFF) | ((pHi & 0xFF) << 8) );
  80. }
  81.  
  82.