Hi I want to access the menu of a HWND and somehow I cant get it to work. itemCount is always -1 but I think I dont even have an hMenu..
my Code is
void bla(){
#if _WIN32
HWND hwnd;
HMENU hMenu;
MENUITEMINFO mmi;
mmi.cbSize = sizeof(MENUITEMINFO);
hwnd = GetForegroundWindow();
hMenu = GetMenu(hwnd);
int itemCount = GetMenuItemCount(hMenu);
std::cout << "item count: " << itemCount << std::endl;
GetMenuItemInfo(hMenu, 0, true, &mmi);
DWORD dw = GetLastError();
#endif
}
What am I doing wrong?