Hi,
I decided not to use a template for my systray menu, and created a function to add menu items into a created menu:
I created a menu with 2 items:Code:void AddMenuItem(int id, char* str) { MENUITEMINFO mi; mi.cbSize = sizeof(MENUITEMINFO); mi.fMask = MIIM_TYPE|MIIM_ID; mi.fType = MFT_STRING; mi.wID = id; mi.dwTypeData = str; InsertMenuItem(menu,0,TRUE, &mi); }
The menu appears correctly.Code:case WM_RBUTTONDOWN: menu = CreatePopupMenu(); AddMenuItem(IDEXIT, "Exit!"); AddMenuItem(IDSTARTM, "Stop wall cycling"); SetForegroundWindow(hWndDlg); GetCursorPos(&p); TrackPopupMenu(menu,TPM_LEFTALIGN |TPM_RETURNCMD|TPM_RIGHTBUTTON, p.x,p.y,0,hWndDlg,NULL); break;
Then i had to process the menu item messages:
But when i select a menu item, nothing happens. What i'm doing wrong here please?Code:case WM_COMMAND: switch(wParam) { case IDSTARTM: //dostuff MessageBeep(0); break; case IDEXIT: //dostuff MessageBeep(0); break; .... }
Thanks alot.



LinkBack URL
About LinkBacks


