home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / CENVIW9.ZIP / MESSAGE.LIB < prev    next >
Text File  |  1994-03-08  |  7KB  |  194 lines

  1. // Message.lib - Cmm code wrapper for the SendMessage() and PostMessage()
  2. // ver.1         Windows functions.  With these routines, any message can
  3. //               be sent or posted to any window.
  4. //
  5. // Supported functions are:
  6. //    PostMessage()
  7. //    SendMessage()
  8. // SYNTAX:
  9. //  bool PostMessage(Window,Message,wParam,lParam)
  10. //  bool PostMessage(Window,Message,wParam,lParamLo,lParamHi)
  11. //   int SendMessage(Window,Message,wParam,lParam)
  12. //   int SendMessage(Window,Message,wParam,lParamLo,lParamHi)
  13. // WHERE:
  14. //    Window - Window handle to send message to or HWND_BROADCAST for all
  15. //    Message - the message to send
  16. //    wParam - the word-size parameter to send
  17. //    lParam - the double-word (32-bit) size paramter to send
  18. //    lParamLo - Low-order word of lParam
  19. //    lParamHi - Hi-order word of lParam
  20. // RETURN:
  21. //    SendMessage() returns the value returned by the window message handler
  22. //    PostMessage() returns boolean for whether the message was posted
  23.  
  24. #define  HWND_BROADCAST    0xFFFF   // send or post to all windows
  25.  
  26. // Here are a bunch of messages that Windows might receive
  27.  
  28. #define WM_NULL             0x0000
  29. #define WM_CREATE           0x0001
  30. #define WM_DESTROY          0x0002
  31. #define WM_MOVE             0x0003
  32. #define WM_SIZE             0x0005
  33. #define WM_ACTIVATE         0x0006
  34. #define WM_SETFOCUS         0x0007
  35. #define WM_KILLFOCUS        0x0008
  36. #define WM_ENABLE           0x000A
  37. #define WM_SETREDRAW        0x000B
  38. #define WM_SETTEXT          0x000C
  39. #define WM_GETTEXT          0x000D
  40. #define WM_GETTEXTLENGTH    0x000E
  41. #define WM_PAINT            0x000F
  42. #define WM_CLOSE            0x0010
  43. #define WM_QUERYENDSESSION  0x0011
  44. #define WM_QUIT             0x0012
  45. #define WM_QUERYOPEN        0x0013
  46. #define WM_ERASEBKGND       0x0014
  47. #define WM_SYSCOLORCHANGE   0x0015
  48. #define WM_ENDSESSION       0x0016
  49. #define WM_SHOWWINDOW       0x0018
  50. #define WM_CTLCOLOR         0x0019
  51. #define WM_WININICHANGE     0x001A
  52. #define WM_DEVMODECHANGE    0x001B
  53. #define WM_ACTIVATEAPP      0x001C
  54. #define WM_FONTCHANGE       0x001D
  55. #define WM_TIMECHANGE       0x001E
  56. #define WM_CANCELMODE       0x001F
  57. #define WM_SETCURSOR        0x0020
  58. #define WM_MOUSEACTIVATE    0x0021
  59. #define WM_CHILDACTIVATE    0x0022
  60. #define WM_QUEUESYNC        0x0023
  61. #define WM_GETMINMAXINFO    0x0024
  62. #define WM_PAINTICON        0x0026
  63. #define WM_ICONERASEBKGND   0x0027
  64. #define WM_NEXTDLGCTL       0x0028
  65. #define WM_SPOOLERSTATUS    0x002A
  66. #define WM_DRAWITEM         0x002B
  67. #define WM_MEASUREITEM      0x002C
  68. #define WM_DELETEITEM       0x002D
  69. #define WM_VKEYTOITEM       0x002E
  70. #define WM_CHARTOITEM       0x002F
  71. #define WM_SETFONT          0x0030
  72. #define WM_GETFONT          0x0031
  73. #define WM_QUERYDRAGICON    0x0037
  74. #define WM_COMPAREITEM      0x0039
  75. #define WM_COMPACTING       0x0041
  76. #define WM_NCCREATE         0x0081
  77. #define WM_NCDESTROY        0x0082
  78. #define WM_NCCALCSIZE       0x0083
  79. #define WM_NCHITTEST        0x0084
  80. #define WM_NCPAINT          0x0085
  81. #define WM_NCACTIVATE       0x0086
  82. #define WM_GETDLGCODE       0x0087
  83. #define WM_NCMOUSEMOVE      0x00A0
  84. #define WM_NCLBUTTONDOWN    0x00A1
  85. #define WM_NCLBUTTONUP      0x00A2
  86. #define WM_NCLBUTTONDBLCLK  0x00A3
  87. #define WM_NCRBUTTONDOWN    0x00A4
  88. #define WM_NCRBUTTONUP      0x00A5
  89. #define WM_NCRBUTTONDBLCLK  0x00A6
  90. #define WM_NCMBUTTONDOWN    0x00A7
  91. #define WM_NCMBUTTONUP      0x00A8
  92. #define WM_NCMBUTTONDBLCLK  0x00A9
  93. #define WM_KEYFIRST         0x0100
  94. #define WM_KEYDOWN          0x0100
  95. #define WM_KEYUP            0x0101
  96. #define WM_CHAR             0x0102
  97. #define WM_DEADCHAR         0x0103
  98. #define WM_SYSKEYDOWN       0x0104
  99. #define WM_SYSKEYUP         0x0105
  100. #define WM_SYSCHAR          0x0106
  101. #define WM_SYSDEADCHAR      0x0107
  102. #define WM_KEYLAST          0x0108
  103. #define WM_INITDIALOG       0x0110
  104. #define WM_COMMAND          0x0111
  105. #define WM_SYSCOMMAND       0x0112
  106.    #define SC_SIZE         0xF000
  107.    #define SC_MOVE         0xF010
  108.    #define SC_MINIMIZE     0xF020
  109.    #define SC_MAXIMIZE     0xF030
  110.    #define SC_NEXTWINDOW   0xF040
  111.    #define SC_PREVWINDOW   0xF050
  112.    #define SC_CLOSE        0xF060
  113.    #define SC_VSCROLL      0xF070
  114.    #define SC_HSCROLL      0xF080
  115.    #define SC_MOUSEMENU    0xF090
  116.    #define SC_KEYMENU      0xF100
  117.    #define SC_ARRANGE      0xF110
  118.    #define SC_RESTORE      0xF120
  119.    #define SC_TASKLIST     0xF130
  120.    #define SC_ICON         SC_MINIMIZE
  121.    #define SC_ZOOM         SC_MAXIMIZE
  122. #define WM_TIMER            0x0113
  123. #define WM_HSCROLL          0x0114
  124. #define WM_VSCROLL          0x0115
  125. #define WM_INITMENU         0x0116
  126. #define WM_INITMENUPOPUP    0x0117
  127. #define WM_MENUSELECT       0x011F
  128. #define WM_MENUCHAR         0x0120
  129. #define WM_ENTERIDLE        0x0121
  130. #define WM_MOUSEFIRST       0x0200
  131. #define WM_MOUSEMOVE        0x0200
  132. #define WM_LBUTTONDOWN      0x0201
  133. #define WM_LBUTTONUP        0x0202
  134. #define WM_LBUTTONDBLCLK    0x0203
  135. #define WM_RBUTTONDOWN      0x0204
  136. #define WM_RBUTTONUP        0x0205
  137. #define WM_RBUTTONDBLCLK    0x0206
  138. #define WM_MBUTTONDOWN      0x0207
  139. #define WM_MBUTTONUP        0x0208
  140. #define WM_MBUTTONDBLCLK    0x0209
  141. #define WM_MOUSELAST        0x0209
  142. #define WM_PARENTNOTIFY     0x0210
  143. #define WM_MDICREATE        0x0220
  144. #define WM_MDIDESTROY       0x0221
  145. #define WM_MDIACTIVATE      0x0222
  146. #define WM_MDIRESTORE       0x0223
  147. #define WM_MDINEXT          0x0224
  148. #define WM_MDIMAXIMIZE      0x0225
  149. #define WM_MDITILE          0x0226
  150. #define WM_MDICASCADE       0x0227
  151. #define WM_MDIICONARRANGE   0x0228
  152. #define WM_MDIGETACTIVE     0x0229
  153. #define WM_MDISETMENU       0x0230
  154. #define WM_CUT              0x0300
  155. #define WM_COPY             0x0301
  156. #define WM_PASTE            0x0302
  157. #define WM_CLEAR            0x0303
  158. #define WM_UNDO             0x0304
  159. #define WM_RENDERFORMAT     0x0305
  160. #define WM_RENDERALLFORMATS 0x0306
  161. #define WM_DESTROYCLIPBOARD 0x0307
  162. #define WM_DRAWCLIPBOARD    0x0308
  163. #define WM_PAINTCLIPBOARD   0x0309
  164. #define WM_VSCROLLCLIPBOARD 0x030A
  165. #define WM_SIZECLIPBOARD    0x030B
  166. #define WM_ASKCBFORMATNAME  0x030C
  167. #define WM_CHANGECBCHAIN    0x030D
  168. #define WM_HSCROLLCLIPBOARD 0x030E
  169. #define WM_QUERYNEWPALETTE  0x030F
  170. #define WM_PALETTEISCHANGING 0x0310
  171. #define WM_PALETTECHANGED   0x0311
  172.  
  173.  
  174. SendMessage(pHwnd,pMsg,pWParam,pLParamLo,pLParamHi)
  175. {
  176.    if ( va_arg() == 4 )
  177.       return ( 1 == DataDimension(pLParamLo) )
  178.            ? SendMessage(pHwnd,pMsg,pWParam,pointer(pLParamLo))
  179.            : SendMessage(pHwnd,pMsg,pWParam,pLParamLo & 0xFFFF,(pLParamLo >> 16) & 0xFFFF);
  180.    return( DynamicLink("USER","SENDMESSAGE",UWORD32,PASCAL,
  181.                        pHwnd,pMsg,pWParam,pLParamHi,pLParamLo) );
  182. }
  183.  
  184. PostMessage(pHwnd,pMsg,pWParam,pLParamLo,pLParamHi)
  185. {
  186.    if ( va_arg() == 4 )
  187.       return ( 1 == DataDimension(pLParamLo) )
  188.            ? PostMessage(pHwnd,pMsg,pWParam,pointer(pLParamLo))
  189.            : PostMessage(pHwnd,pMsg,pWParam,pLParamLo & 0xFFFF,(pLParamLo >> 16) & 0xFFFF);
  190.    return( DynamicLink("USER","POSTMESSAGE",SWORD16,PASCAL,
  191.                        pHwnd,pMsg,pWParam,pLParamHi,pLParamLo) );
  192. }
  193.  
  194.