Create a very simple menu
The details that the Platform SDK gives are very confusing for something very simple. All I'm trying to do is create a basic menu. I, so far, just want a menu called "Test" with 3 options - 7, 15, and 40, all as strings without any special "eye candy". "Test" is like "file", "edit", and the related, always visible at the top. The other options appear only when I click on the "Test" menu. Upon selecting one, a variable gets set to this value. I'm stumped with just understanding what the SDK is stating, especially setting up the "MENUITEMINFO" structure.
I have no idea if anything is set up properly or not as I'm also getting an error (and I'm doing what the SDK says). Note: I'm using C for programming, not C++.
Code:
// at the top
HMENU MenuHandle;
MENUITEMINFO TestMenuInfo;
// in my WinMain function right after window creation
MenuHandle = CreateMenu(); // assign the handle to the menu
// fill in the MENUITEMINFO structure
TestMenuInfo.cbSize = sizeof(MENUITEMINFO); // error - cannot convert
TestMenuInfo.fMask = MIIM_TYPE; // not sure what I need here
TestMenuInfo.fType = MFT_MENUBREAK | MFT_STRING; // not sure what I need here
TestMenuInfo.dwTypeData = "Test"; // The menu should be called "test"
TestMenuInfo.cch = sizeof(TestMenuInfo.dwTypeData)++; // String size plus 1
InsertMenuItem(MenuHandle, 0, 1, TestMenuInfo); // add the "Test" menu
The error that shows up is "error C2440: 'function' : cannot convert from 'MENUITEMINFO' to 'LPCMENUITEMINFOA'", if that helps. For the options that appear, I'll obviously need the "MFT_RADIOCHECK" flag for fType and I'll also need to use fState. How close am I though?