I'm trying to write a wrapper for the Windows API that will let me use a single function to replace code such as this:
Code:
hMenu = CreateMenu();
hSubMenu = CreatePopupMenu();
AppendMenu(hSubMenu, MF_GRAYED, ID_FILE_NEW, "&New");
AppendMenu(hSubMenu, MF_GRAYED, ID_FILE_OPEN, "&Open...");
AppendMenu(hSubMenu, MF_GRAYED, ID_FILE_SAVE, "&Save");
AppendMenu(hSubMenu, MF_GRAYED, ID_FILE_SAVEAS, "&Save As...");
AppendMenu(hSubMenu, MF_SEPARATOR, NULL, NULL);
AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");
AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");
SetMenu(hWnd, hMenu);
However, the problem comes when I try to make the single function. What I would like to do is something along the lines of this:
wCreateMenu(char* poptitle, char* submenu1, char* submenu2, ... , char* submenuN) where you can add in as many sub-menus as you would like. The problem is, I don't know how to tell C++ that "I do not know how many variables will be passed, please be able to work with them."
I found a couple of tutorials, but the way they explained it made absolutely no sense whatsoever. Here's the links to those.
http://www.experts-exchange.com/Prog..._20553366.html
http://www.codeproject.com/cpp/argfunctions.asp
Help would be appreciated.