home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cenvi23.zip
/
WINMSG.LIB
< prev
next >
Wrap
Text File
|
1995-03-28
|
3KB
|
82 lines
// WinMsg.lib - Functions for WinPostMsg(), WinSendMsg() and related
// ver.2
//
//**** 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 CEnvi2 without CEnvi2PM; default False
// RETURN: boolean TRUE if able to post, else boolean FALSE
//
//
//**** WinBroadcastMsg(): Broadcast a message to all windows
// SYNTAX: bool WinBroadcastMsg(int ParentWinHandle,int MessageID,
// int Param1,int Param2,int Command)
// WHERE: ParentWinHandle: any PM window handle; will broadcast to children of this window
// MessageID; unique message identifier - often a WM_xxx message
// Param1, Param2: input parameters with meaning depending on MessageID
// Command: Broadcast message command, bitwise OR of following
#define BMSG_POST 0
#define BMSG_SEND 1
#define BMSG_POSTQUEUE 2
#define BMSG_DESCENDANTS 4
#define BMSG_FRAMEONLY 8
// NOTE: BMSG_POST, BMSG_SEND, and BMSG_POSTQUEUE or mutually exclusive
// RETURN: boolean TRUE if able to post or send to all, 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);
}
WinBroadcastMsg(pParent,pMsg,pParam1,pParam2,pCmd)
{
#define ORD_WIN32BROADCASTMSG 901
return PMDynamicLink("PMWIN",ORD_WIN32BROADCASTMSG,BIT32,CDECL,
pParent,pMsg,pParam1,pParam2,pCmd);
}
MakeLongFromShorts(pLo,pHi)
{
return ( (pLo & 0xFFFF) | ((pHi & 0xFFFF) << 16) );
}
MakeShortFromBytes(pLo,pHi)
{
return ( (pLo & 0xFF) | ((pHi & 0xFF) << 8) );
}