How Windows 3.11 Processed Keyboard Menu Shortcuts

In Microsoft Windows 3.11, keyboard shortcut commands for application menu access were processed through a low-level event pipeline that converted hardware interrupts into structured Windows messages. The operating system distinguished between two primary forms of keyboard menu navigation: direct accelerator keys (such as Ctrl+O) and mnemonic access keys (such as Alt+F). By utilizing an application's event message loop, accelerator translation tables, and standard system message routing, Windows 3.11 allowed users to navigate interface menus and execute application functions entirely from the keyboard.

At the lowest level, pressing a key generated a hardware interrupt (IRQ 1) handled by the 16-bit keyboard device driver (KEYBOARD.DRV). The driver converted raw keyboard scan codes into virtual-key codes and passed them to the operating system's raw input queue. Windows then routed these inputs to the active application thread's message queue as specific keystroke messages.

For mnemonic menu access—where users press the Alt key or F10 in combination with an underlined letter in a menu title—Windows 3.11 relied on system keystroke messages. Standard keys produced WM_KEYDOWN and WM_KEYUP messages, but any key pressed while holding the Alt key, or pressing the F10 key alone, generated WM_SYSKEYDOWN and WM_SYSKEYUP messages.

When the default window procedure (DefWindowProc) received a WM_SYSKEYDOWN containing a menu access key, the system initiated its internal modal menu-handling loop:

  1. Windows evaluated the menu resource defined in the application's executable file, looking for an ampersand (&) prefix before the corresponding letter in the menu string.
  2. The operating system seized input focus, drew the menu bar in an active state, and dropped down the requested sub-menu.
  3. Subsequent keystrokes navigated the hierarchical pop-up menus using arrow keys or matching mnemonic letters, processed entirely by Windows until an item was selected with the Enter key or cancelled with the Escape key.
  4. Once an item was selected, Windows posted a WM_COMMAND message to the window procedure, passing the unique integer ID of the menu item in the wParam parameter.

For non-mnemonic keyboard shortcuts, known as keyboard accelerators, Windows 3.11 used a different mechanism that bypassed the visual menu interface entirely. Applications defined an accelerator table in their resource files (.RC), mapping specific key combinations directly to menu command identifiers.

To process these combinations, the application's central message loop explicitly called the TranslateAccelerator API function before dispatching messages:

while (GetMessage(&msg, NULL, 0, 0)) {
    if (!TranslateAccelerator(hwndMain, hAccelTable, &msg)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
}

When a keystroke occurred, TranslateAccelerator intercepted the WM_KEYDOWN or WM_SYSKEYDOWN message and checked it against the active accelerator table. If a match was found, the function intercepted the key event and directly translated it into a WM_COMMAND message (or WM_SYSCOMMAND for system-level actions) containing the corresponding menu command ID. The window's main procedure received this command immediately, executing the associated function without ever opening, rendering, or traversing the graphical menu.