Jump to content

Window messages

From NikiWiki
Revision as of 13:59, 22 January 2004 by Cinc (talk | contribs)

Menu related

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 WM_0196    0x0196

MM_SUMMON (cause menu to be displayed)


#define MM_DISMISS 0x0197

Cause menu to be hidden


#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

mp1
SHORT1FROMMP(mp1)
character to match
SHORT2FROMMP(mp1)
number of submenu levels to search
                          0 = none
                          1 = top-level (this menu)
                          2 = top+first submenu
                          3 = top+first 2 submenus
                          (etc.)
                         -1 = all
mp2
pointer to HWND of menu where match found

Returns both the index of the item in the menu that matched and the level of the match : MRFROM2SHORT (hwndmenu, index). In addition,

  • mp2 is updated to contain the window handle of the menu that

contained the mnemonic.

This message is sent withing the menu code when the WM_CHAR is being processes and the menu code is trying to find a mnemonic match for the character pressed. This message is not sent to the owner window, so you must subclass the menu window in order to receive this message.

(Source: newsgroup)


#define MM_DELETEITEMBYPOS 0x01f1

Delete a menu item by its position

mp1
position of item to delete
mp2
unused

Returns the number of items remaining in the menu.

This message will only delete an item in the menu specified. It also destroys any submenu windows and deletes the bitmap associated with the menu item if the bitmap was not created by the application.

(Source: newsgroup)


#define MM_REMOVEITEMBYPOS 0x01f2

Remove a menu item by its position

mp1
position of item to remove
mp2
unused

Returns the number of items remaining in the menu

This message will only remove an item in the menu specified. This message does not destroy any submenus or delete any bitmaps associated with the menu item.

(Source: newsgroup)


#define WM_01f3    0x01f3

MM_QUERYITEMBYPOS: Query MENUITEM by its position

mp1
menuitem index
mp2
PMENUITEM (16-bit pointer)
Returns TRUE if the request is successful

This message will only query an item in the specified menu. This message will not retrieve the text for MIS_TEXT items; use the WM_QUERIITEMTEXTBYPOS message to retrieve the text.

Sent to menu after WM_01f5 has identified menuitem to hilite. Seen when XWP's 'Sliding menu selection' is enabled.

(Source: newsgroup)


#define MM_SETITEMBYPOS 0x01f4

Set MENUITEM by its position.

mp1
Position of item in menu
mp2
PMENUITEM (16-bit pointer)

Returns TRUE if the request is successful

This message will only set an item in the specified menu. The iPosition field on the MENUITEM structure is ifnored because you cannot change the position of a menu item. If the submenu or bitmap handle is changing, the previous sumbenu window handle or bitmap handle is not deleted during the handling of this message.

(Source: newsgroup)


#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)


  1. 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.