home *** CD-ROM | disk | FTP | other *** search
- // WinMsg.lib - Functions for WinPostMsg(), WinSendMsg() and related
- // ver.1
- //
- //**** WinSendMsg(): Send a message to a window handle
- // SYNTAX: int WinSendMsg(int WindowHandle,int MessageID,int Param1,int Param2)
- // WHERE: WindowHandle: any PM window handle
- // MessageID; unique message identifier - often a WM_xxx message
- // Param1, Param2: input parameters with meaning depending on MessageID
- // RETURN: Returns value returned by window's message function
- //
- //
- //**** WinPostMsg(): Post a message to a window handle
- // SYNTAX: bool WinPostMsg(int WindowHandle,int MessageID,int Param1,int Param2
- // [,bool MustPostFromPM])
- // WHERE: WindowHandle: any PM window handle
- // MessageID; unique message identifier - often a WM_xxx message
- // Param1, Param2: input parameters with meaning depending on MessageID
- // MustPostFromPM: If False then can post from CEnvi without CEnvi2PM; default False
- // RETURN: boolean TRUE if able to post, else boolean FALSE
- //
- //
- //**** MakeLongFromShorts(): combine two shorts (16-bit) into a long (32-bit)
- // SYNTAX: int MakeLongFromShorts(LowShort,HighShort)
- // WHERE: LowShort, HighShort: two 16-bit values
- // RETURN: Return integer (low | high << 16)
- //
- //
- //**** MakeShortFromBytes(): combine two bytes (8-bit) into a Short (16-bit)
- // SYNTAX: int MakeShortFromBytes(LowByte,HighByte)
- // WHERE: LowByte, HighByte: two 8-bit values
- // RETURN: Return integer (low | high << 8)
- //
- //
-
- WinSendMsg(pHwnd,pMsg,pParam1,pParam2)
- {
- #define ORD_WIN32SENDMSG 920
- return PMDynamicLink("PMWIN",ORD_WIN32SENDMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
- }
-
- WinPostMsg(pHwnd,pMsg,pParam1,pParam2,pMustPostFromPM)
- {
- #define ORD_WIN32POSTMSG 919
- return ( va_arg() < 5 || !pMustPostFromPM )
- ? DynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2)
- : PMDynamicLink("PMWIN",ORD_WIN32POSTMSG,BIT32,CDECL,pHwnd,pMsg,pParam1,pParam2);
- }
-
- MakeLongFromShorts(pLo,pHi)
- {
- return ( (pLo & 0xFFFF) | ((pHi & 0xFFFF) << 16) );
- }
-
- MakeShortFromBytes(pLo,pHi)
- {
- return ( (pLo & 0xFF) | ((pHi & 0xFF) << 8) );
- }
-