home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / cenvi29.zip / WINMSG.LIB < prev    next >
Text File  |  1994-03-08  |  2KB  |  59 lines

  1. // WinMsg.lib - Functions for WinPostMsg(), WinSendMsg() and related
  2. // ver.1
  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 CEnvi without CEnvi2PM; default False
  19. // RETURN: boolean TRUE if able to post, else boolean FALSE
  20. //
  21. //
  22. //**** MakeLongFromShorts(): combine two shorts (16-bit) into a long (32-bit)
  23. // SYNTAX: int MakeLongFromShorts(LowShort,HighShort)
  24. // WHERE: LowShort, HighShort: two 16-bit values
  25. // RETURN: Return integer (low | high << 16)
  26. //
  27. //
  28. //**** MakeShortFromBytes(): combine two bytes (8-bit) into a Short (16-bit)
  29. // SYNTAX: int MakeShortFromBytes(LowByte,HighByte)
  30. // WHERE: LowByte, HighByte: two 8-bit values
  31. // RETURN: Return integer (low | high << 8)
  32. //
  33. //
  34.  
  35. WinSendMsg(pHwnd,pMsg,pParam1,pParam2)
  36. {
  37.    #define ORD_WIN32SENDMSG   920
  38.    return PMDynamicLink("PMWIN",ORD_WIN32SENDMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
  39. }
  40.  
  41. WinPostMsg(pHwnd,pMsg,pParam1,pParam2,pMustPostFromPM)
  42. {
  43.    #define ORD_WIN32POSTMSG   919
  44.    return ( va_arg() < 5 ||  !pMustPostFromPM )
  45.         ? DynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2)
  46.         : PMDynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
  47. }
  48.  
  49. MakeLongFromShorts(pLo,pHi)
  50. {
  51.    return ( (pLo & 0xFFFF) | ((pHi & 0xFFFF) << 16) );
  52. }
  53.  
  54. MakeShortFromBytes(pLo,pHi)
  55. {
  56.    return ( (pLo & 0xFF) | ((pHi & 0xFF) << 8) );
  57. }
  58.  
  59.