/*static*/ VOID CreateVdmMenu(HANDLE ConOutHandle) { hConsoleMenu = ConsoleMenuControl(ConOutHandle, ID_SHOWHIDE_MOUSE, ID_VDM_QUIT); if (hConsoleMenu == NULL) return; VdmMenuPos = GetMenuItemCount(hConsoleMenu); AppendMenuItems(hConsoleMenu, VdmMainMenuItems); DrawMenuBar(GetConsoleWindow()); }
static VOID CreateVdmMenu(HANDLE ConOutHandle) { HMENU hVdmSubMenu; UINT_PTR ItemID; UINT Pos; USHORT i; WCHAR szNoMedia[100]; WCHAR szMenuString1[256], szMenuString2[256]; hConsoleMenu = ConsoleMenuControl(ConOutHandle, ID_CAPTURE_MOUSE, ID_VDM_DRIVES + (2 * ARRAYSIZE(GlobalSettings.FloppyDisks))); if (hConsoleMenu == NULL) return; /* Get the position where we are going to insert our menu items */ VdmMenuPos = GetMenuItemCount(hConsoleMenu); /* Really add the menu if it doesn't already exist (in case eg. NTVDM crashed) */ if (!VdmMenuExists(hConsoleMenu)) { /* Add all the menu entries */ AppendMenuItems(hConsoleMenu, VdmMainMenuItems); /* Add the removable drives menu entries */ hVdmSubMenu = GetSubMenu(hConsoleMenu, VdmMenuPos + 2); // VdmMenuItems Pos = 3; // After the 2 items and the separator in VdmMenuItems LoadStringW(GetModuleHandle(NULL), IDS_NO_MEDIA, szNoMedia, ARRAYSIZE(szNoMedia)); LoadStringW(GetModuleHandle(NULL), IDS_VDM_MOUNT_FLOPPY, szMenuString1, ARRAYSIZE(szMenuString1)); /* Drive 'x' -- Mount */ for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i) { ItemID = ID_VDM_DRIVES + (2 * i); /* Add the item */ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i, szNoMedia); szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL; InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID, szMenuString2); } LoadStringW(GetModuleHandle(NULL), IDS_VDM_EJECT_FLOPPY, szMenuString1, ARRAYSIZE(szMenuString1)); /* Drive 'x' -- Eject */ for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i) { ItemID = ID_VDM_DRIVES + (2 * i); /* Add the item */ _snwprintf(szMenuString2, ARRAYSIZE(szMenuString2), szMenuString1, i); szMenuString2[ARRAYSIZE(szMenuString2) - 1] = UNICODE_NULL; InsertMenuW(hVdmSubMenu, Pos++, MF_STRING | MF_BYPOSITION, ItemID + 1, szMenuString2); } /* Refresh the menu state */ UpdateVdmMenu(); DrawMenuBar(hConsoleWnd); } }