[C\C++ - win32] - using WM_SYSCOMMAND: can i get the menu handle and position?

using the WM_SYSCOMMAND message: can i get the menu handle?
(i can use the GetSystemMenu(), but don't give me what menu handle was clicked :( )
Last edited on
using the WM_INITMENUPOPUP message i can get the menu handle:
1
2
3
4
5
6
7
static HMENU menuhandle=NULL;
case WM_INITMENUPOPUP:
                {
                    menuhandle=(HMENU)wParam;
                    return 0;
                }
                break;

i have 1 code, on WM_SYSCOMMAND message, for get the menu item selected by mouse for get the menu position:
1
2
3
4
5
6
7
8
9
int i=0;
                        for(i=0; i<GetMenuItemCount(menuhandle); i++)
                        {
                            if(HiliteMenuItem(HandleWindow,menuhandle,i,MF_BYPOSITION) == true)
                            {
                                menuposition=(UINT)i;
                                break;
                            }
                        }

but i always, the i, is 0(zero). so what i'm doing wrong with the for loop?
Topic archived. No new replies allowed.