Some lines of simple code: //////////////////////////////////////////////////////////////// MENUITEMINFO mmi, temp; ZeroMemory(&mmi,sizeof(mmi)); mmi.cbSize = sizeof(mmi); // Assign user data to menu item mmi.fMask = MIIM_DATA; mmi.dwItemData = (DWORD) pData; ::SetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &mmi); // Try getting the data back for testing purpose temp.cbSize = sizeof(MENUITEMINFO); temp.fMask = MIIM_DATA; BOOL rc = ::GetMenuItemInfo(pMenu->m_hMenu, nPos, TRUE, &temp); if (!rc) { int iErrCode = GetLastError(); // iErrCode will be 87 } When waiting for your replies, I found that the function GetMenuItemInfo will work properly in WinNT if (cbSize==sizeof(MENUITEMINFO) - 4). I think the problem is somewhere around the WINVER. In WinUser.h I saw these: typedef struct tagMENUITEMINFOW { UINT cbSize; UINT fMask; UINT fType; // used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0) UINT fState; // used if MIIM_STATE UINT wID; // used if MIIM_ID HMENU hSubMenu; // used if MIIM_SUBMENU HBITMAP hbmpChecked; // used if MIIM_CHECKMARKS HBITMAP hbmpUnchecked; // used if MIIM_CHECKMARKS ULONG_PTR dwItemData; // used if MIIM_DATA LPWSTR dwTypeData; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0) UINT cch; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0) #if(WINVER >= 0x0500) HBITMAP hbmpItem; // used if MIIM_BITMAP #endif } So, I think the function GetMenuItemInfo failed in Windows NT because of the size of returned variable LPMENUITEMINFO(&temp). GetMenuItemInfo expected to see the size of returned variable is 44. However, sizeof(MENUITEMINFO) returned 48. In my opinion, this caused the error. Anyway, thanks for your replies. ____ Tuan