I've created a system tray icon with an asscociated popup menu. Using
TrackPopupMenuEx, my program receives a WM_MENUSELECT when a user selects an
item on the menu:
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
Param)
{
case WM_RBUTTONDOWN::
{
...
TrackPopupMenuEx(menu, TPM_RIGHTBUTTON|TPM_BOTTOMALIGN, pt.x, pt.y,
hwnd, NULL);
...
}
case WM_MENUSELECT:
{
UINT item = (UINT) LOWORD(wParam);
UINT flags = (UINT) HIWORD(wParam);
HMENU hmenu = (HMENU) lParam;
...
I can determine that MF_MOUSESELECT has occurred using flags, but hmenu is
NULL and item is 0.
According to the documentation, a NULL hmenu indicates the system has closed
the menu.
Does anyone have any insight as to why I'm receiving a NULL menu? Is this a
timing issue related to the system closing the menu after choosing a menu
item?
Thanks,
Ryan Hehn
"Ryan Hehn" <rbh...@NOSPAMhydro.mb.ca> wrote in message
news:eugGFxBfAHA.1244@tkmsftngp03...
WM_MENUSELECT is where a cursor is over an menu item, not when the user
selects something. You should use the HANDLE_WM_COMMAND(...) command.
Ryan Hehn <rbh...@NOSPAMhydro.mb.ca> wrote in message
news:eugGFxBfAHA.1244@tkmsftngp03...