Hi,

I decided not to use a template for my systray menu, and created a function to add menu items into a created menu:

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);
}
I created a menu with 2 items:

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;
The menu appears correctly.
Then i had to process the menu item messages:
Code:
case WM_COMMAND:
 switch(wParam)
 {
  case IDSTARTM:		
   //dostuff
   MessageBeep(0);
   break;

  case IDEXIT:		
   //dostuff
   MessageBeep(0);
   break;
....
 }
But when i select a menu item, nothing happens. What i'm doing wrong here please?

Thanks alot.