LoadMenuIndirect

  • Thread starter Thread starter Steve Curvey
  • Start date Start date
S

Steve Curvey

Guest
First off, thanks ahead of time for any help. Now my question is, what is the proper way to setup the structures?

Here is my code, which doesn't work correctly, to do exit a simple popup with exit on it (for popup below file menu option)

std::vector<WORD> menuTemplate2;
// MENUEX_TEMPLATE_HEADER
//WORD version = 1;
//WORD offset = 0; // low high
//DWORD dwHel = 0;
menuTemplate2.push_back(0x0000); // word offset (if I put 4 here it refuses to load)
menuTemplate2.push_back(0x0001); // version
menuTemplate2.push_back(0x0000); // dwHel
menuTemplate2.push_back(0x0000); // dwHel

typedef struct { DWORD dwHelpId; DWORD dwType; DWORD dwState; DWORD menuId;
WORD bResInfo; WCHAR szText; DWORD dwHelpId; } MENUEX_TEMPLATE_ITEM;

#define MFR_END 0x80
#define MFR_POPUP 0x01

menuTemplate2.push_back(HIWORD(MFT_STRING)); // dwType
menuTemplate2.push_back(LOWORD(MFT_STRING)); // dwType
menuTemplate2.push_back(HIWORD(MFS_ENABLED)); // dwState
menuTemplate2.push_back(LOWORD(MFS_ENABLED)); // dwState
menuTemplate2.push_back(0x0000); // menuId
menuTemplate2.push_back(0x0000); // menuId

menuTemplate2.push_back(0x0000); // bResInfo
menuTemplate2.push_back(MFR_POPUP | MFR_END); // bResInfo
menuTemplate2.push_back(L'E'); // menu text
menuTemplate2.push_back(L'x');
menuTemplate2.push_back(L'i');
menuTemplate2.push_back(L't');
menuTemplate2.push_back(L'\0');
menuTemplate2.push_back(L'\0'); // extra 0 for DWORD boundry Padding
//menuTemplate2.push_back(0x0000); //helpid - no helpid because is popup
//menuTemplate2.push_back(0x0100); //helpid

Continue reading...
 
Back
Top