Menu menubar = getShell().getMenuBar();
private int RemoveMenus(int hmenuShared) {	if (menubar == null || menubar.isDisposed()) return COM.S_FALSE;	int hMenu = menubar.handle;		Vector ids = new Vector();	if (this.fileMenuItems != null) {		for (int i = 0; i < this.fileMenuItems.length; i++) {			MenuItem item = this.fileMenuItems[i];			if (item != null && !item.isDisposed()) {				int index = item.getParent().indexOf(item);				// get Id from original menubar				int id = getMenuItemID(hMenu, index);				ids.addElement(new Integer(id));			}		}	}	if (this.containerMenuItems != null) {		for (int i = 0; i < this.containerMenuItems.length; i++) {			MenuItem item = this.containerMenuItems[i];			if (item != null && !item.isDisposed()) {				int index = item.getParent().indexOf(item);				int id = getMenuItemID(hMenu, index);				ids.addElement(new Integer(id));			}		}	}	if (this.windowMenuItems != null) {		for (int i = 0; i < this.windowMenuItems.length; i++) {			MenuItem item = this.windowMenuItems[i];			if (item != null && !item.isDisposed()) {				int index = item.getParent().indexOf(item);				int id = getMenuItemID(hMenu, index);				ids.addElement(new Integer(id));			}		}	}	int index = OS.GetMenuItemCount(hmenuShared) - 1;	for (int i = index; i >= 0; i--) {		int id = getMenuItemID(hmenuShared, i);		if (ids.contains(new Integer(id))){			OS.RemoveMenu(hmenuShared, i, OS.MF_BYPOSITION);		}	}	return COM.S_OK;}