adding menus at runtime
i dont like making menus at design time, because i like to be able to modify anything about my program that i want, including menus. but i cant get the code exactly right. heres what im doing at the moment:
unfortunately a menu doesn't appear, but there is a small buffer area at the top of the client area, about half the height of a menu bar. why wont the code work?
Notify(hwnd,"success"); //my own routine, its just a messagebox
Appendmenu() is obslete. Try playing with this code
#define ID_PAGE_1 40001
//set the text
sprintf(sBuffer,"Page %d of %d.",i+1,MaxPages);
//fill the structure
MenuItemInfo.fMask=MIIM_DATA| MIIM_ID| MIIM_TYPE| MIIM_ID| MIIM_CHECKMARKS |MIIM_STATE |MIIM_SUBMENU;
Try changing your last AppendMenu( ) to this...
AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hPopUp, "&File" );
thanks mr wizard, it works now. that was pretty silly of me, i mean, you cant have a menu without a caption.
sorry novacain, i didn't get to finish implementing your method, when i found that it was easier the way i was doing it. i understand though that using InsertMenuItem gives you more options and capabilities, so next time i need those things i'll use your method.