Window messages
A lot of this information was posted by Martin Lafaix (http://lafaix.online.fr) in OS/2-NGs, so credits probably belong to him :-). He wrote: "Those interested in menu stuff can read the relevant code parts in xwp."
All pointers used by BYPOS messages are *not* thunked by PM when the messages are sent, so you *must* do the conversion yourself, using something like :
#define MAKE_16BIT_POINTER(p) ((PVOID)MAKEULONG(LOUSHORT(p), \ (HIUSHORT(p) << 3) | 7))
There are also some undocumented menu window styles:
MS_ROOT (0x00000008L) menu is the root of the menu hierarchy MS_POPUP (0x00000010L) menu is a popup-menu
#define MM_MENUCHAR 0x003f
Non-mnemonic menu char pressed.
#define MM_DISMISSMENU 0x0187
#define MM_FNEEDACTIVATE 0x0196 Called when menu is need to be activated.
- mp1
- pointer to RECTL structure which contains screen coordinates of menu item currently selected
- mp2
- SHORT1 contains an item ID if PU_SELECTITEM and/or PU_POSITIONONITEM flags is specified for menu; SHORT2 contains some u_PU_* flags combination (see below)
Note: blocking this message disables menu pointer moving
#define u_PU_NONE 0x0000 /* If invoked by keyboard */ /*? #define u_PU_SELECTITEM 0x0010 / * Set selected item (use with kbd) */ #define u_PU_POSITIONONITEM 0x0020 /* Need idItem parameter */ #define u_PU_KEYBOARD 0x0100 /* If keyboard use allowed */ #define u_PU_MOUSEBUTTON3 0x0200 /* If button3 use allowed */ #define u_PU_MOUSEBUTTON2 0x0400 /* If button2 use allowed */ #define u_PU_MOUSEBUTTON1 0x0800 /* If button1 use allowed */ #define u_PU_MOUSEBUTTON1DOWN 0x1000 /* If invoked by button 1 */ #define u_PU_MOUSEBUTTON2DOWN 0x2000 /* If invoked by button 2 */ #define u_PU_MOUSEBUTTON3DOWN 0x3000 /* If invoked by button 3 */ #define u_PU_VCONSTRAIN 0x4000 /* Keep menu on top and bottom edge */ #define u_PU_HCONSTRAIN 0x8000 /* Keep menu on left and right edge */
PU_* constants actual for MM_FNEEDACTIVATE message
#define MM_DISMISS 0x0197
Cause menu to be hidden Note: blocking this message disables menu hiding
#define MM_STARTTRACKING 0x0198
Capture mouse and begin tracking
#define MM_SUMMONCHAIN 0x0199
Display menu and all owner menus
#define WM_019a 0x019a
MM_DISMISSCHAIN (hide menu and all owners menus)
#define WM_019b 0x019b
MM_ISCHAINENABLED (are menu and all all owners enabled ?)
#define WM_019c 0x019c
MM_QUERYMENUSAVEDFOCUS (query window to receive focus at end)
#define WM_019d 0x019d
MM_SETMENUSAVEDFOCUS (set window to receive focus at end)
#define MM_SELECTITEMBYPOS 0x019e
Set selection state by its position.
#define WM_019f 0x019f
???
#define MM_MATCHMNEMONIC 0x01f0
Find match of mnemonic char in menu.
#define MM_DELETEITEMBYPOS 0x01f1
Delete a menu item by its position.
#define MM_REMOVEITEMBYPOS 0x01f2
Remove a menu item by its position.
#define MM_QUERYITEMBYPOS 0x01f3
Query MENUITEM by its position.
#define MM_SETITEMBYPOS 0x01f4
Set MENUITEM by its position.
#define MM_QUERYITEMATTRBYPOS 0x01f5 Query the attribute by its position
- mp1
- 0 to number of items in menu. Position of the item to query.
- mp2
- Requested attributes mask.
Returns the current state of the attributes requested.
The attributes returned are the current state values of the menu item ANDed with the attribute mask specified in mp2. It does not change any of the attributes of the menu item.
1 or more msgs sent to menu under pointer for each mouse move. Apparently used to identify which menuitem to hilite. Seen when XWP's 'Sliding menu selection' is enabled.
(Source: newsgroup)
#define MM_SETITEMATTRBYPOS 0x01f6
Set the attribute by its position
- mp1
- position of the item to set
- mp2
- SHORT1FROMMP(mp2)
- attributes mask
- SHORT2FROMMP(mp2)
- attribute flags
Teturns TRUE if the attributes were successfully modified.
Only those attributes specified by the attributes mask are modified by this message
(Source: newsgroup)
#define MM_QUERYITEMTEXTBYPOS 0x01f7
Query text of item by its position.
- mp1
- SHORT1FROMMP(mp1)
- Position of the item to query the text.
- SHORT2FROMMP(mp2)
- Maximum nomber of bytes to copy (includes the null termination character).
- mp2
- PSTRL (16-bit pointer)
Returns the length of the string copied to PSTRL.
(Source: newsgroup)
- define MM_QUERYITEMTEXTLENGTHBYPOS 0x01f8
Query text length by its position.
- mp1
- position of the item to query
- mp2
- unused
Returns the length of the string.
(Source: newsgroup)
#define MM_SETITEMTEXTBYPOS 0x01f9
Set text of item by its position.
- mp1
- position of item to query
- mp2
- PSTRL (16-bit pointer)
Returns TRUE if the request is successful.
(Source: newsgroup)
#define MM_SETITEMHANDLEBYPOS 0x01fa
Set bitmap or ownerdraw handle by its position.
- mp1
- position of the item to query
- mp2
- item handle
Returns TRUE if the request is successful.
This message only applies to menu items with the MIS_BITMAP or MIS_OWNERDRAW style.
(Source: newsgroup)
#define MM_PORTHOLEINIT 0x01fb
Submenu about to be displayed
- mp1
- SHORT1FROMMP(mp1)
- position of submenu in the menu
- SHORT2FROMMP(mp1)
- attribute of the menu item
- mp2
- menu handle containing the item
Return code ignored for this message.
This message is sent from the menu code to its owner just prior to summoning a pop-up menu. Upon return from the processing of this message, PM will again retrieve the submenu handle for the selected item. This allows an application to replace the submenu just prior to the submenu being displayed.
(Source: newsgroup)
#define MM_SETITEMCHECKMARKBYPOS 0x01fc
Set checkmark bitmap by its position
- mp1
- SHORT1FROMMP(mp1)
- Position of menu item to set
- SHORT2FROMMP(mp1)
- TRUE bitmap is for the checked state FALSE bitmap is for the unchecked state
- mp2
- Bitmap handle
Returns TRUE if the request is successful.
The checkmark can be set for both the checked or unchecked state. If a bitmap is not specified for one of the states, the system default bitmap is used.
(Source: newsgroup)
#define MM_SETITEMCHECKMARK 0x0210
Set checkmark to display for item
- mp1
- SHORT1FROMMP(mp1)
- ID of the menu item to set
- SHORT2FROMMP(mp1)
- TRUE bitmap is for checked state FALSE bitmap is for the unchecked state.
- mp2
- bitmap handle
Returns TRUE if the request is successful.
If a bitmap is not specified for one of the states, the system default bitmap is used.
#define WM_0693 0x0693
- mp1
- ctl id
- mp2
- hwnd
Sent by MS_ACTIONBAR menus to owner on MBx-down.
(Source: newsgroup)
There seems to be no equivalent to MM_QUERYSELITEMID (i.e., querying the currently selected item by position). That's why, in xwp, the autohiliting behaves strangely in some netscape 4.x menus, where most items have the same ID.
(Source: newsgroup)
Misc messages
#define WM_0444 0x0444
- mp1
- 0
- mp2
- 0
Sent to titlebar by frame when activation state changes.
#define WM_0453 0x0453
???
#define WM_0692 0x0692
- mp1
- 1
- mp2
- hwnd
Periodically sent by a modal dialog to itself.
#define WM_MOVEACROSSWINDOW 0x041F
- mp1
- unknown
- mp2
- unknown
Called when mouse pointer moves across window. Note: this is notify message.
#define WM_MOVEALONGWINDOW 0x041E
- mp1
- unknown
- mp2
- unknown
Called when mouse pointer moves along window. Note: this is notify message.
#define WM_PAINT_WITHHPS 0x020D
- mp1
- hps to be used
- mp2
- uknown (possibly not used)
Basically the same as WM_PAINT but HPS is given (so no WinBeginPaint and WinEndPaint are required). All standard controls support this.