Windows 98 Desktop Context Menu Customization

This article examines how Microsoft Windows 98 handled customizations for the desktop right-click context menu. Driven by the Windows Explorer shell architecture and the newly integrated Active Desktop components, Windows 98 processed these customizations through a combination of Windows Registry keys, static shell verbs, and dynamically loaded Component Object Model (COM) shell extensions.

In Windows 98, the desktop functioned as a virtual shell folder mapped to both the file system directory (C:\Windows\Desktop) and the root of the shell namespace. When a user right-clicked on an empty area of the desktop, the operating system's shell process (explorer.exe) initiated an event to assemble the context menu dynamically rather than displaying a static, hardcoded list.

The customization process relied primarily on the Windows Registry. Windows 98 checked specific paths under HKEY_CLASSES_ROOT to determine which menu items to display:

  • Static Verbs: Developers and administrators could add basic command entries under HKEY_CLASSES_ROOT\Directory\Background\shell or HKEY_CLASSES_ROOT\Folder\shell. Each subkey represented a menu label, containing a command subkey specifying the executable path and arguments to run when clicked.
  • Shell Extensions: Dynamic customizations were registered under HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers. Here, keys pointed to the unique Class Identifier (CLSID) of an in-process COM server (a DLL) registered in HKEY_CLASSES_ROOT\CLSID.

When generating the desktop context menu, Windows 98 executed a structured sequence via COM interfaces:

  1. Instantiation and Initialization: The shell queried the Registry for registered handlers and called CoCreateInstance to load the corresponding DLLs into the explorer.exe address space. It then queried each object for the IShellExtInit interface, calling IShellExtInit::Initialize to pass context data, such as a pointer to an item identifier list (PIDL) representing the desktop background.
  2. Menu Construction: The shell queried the object for the IContextMenu (or IContextMenu2 / IContextMenu3) interface and invoked QueryContextMenu. This method allowed the extension to insert custom menu items, set flags (such as grayed or checked states), and create submenus dynamically.
  3. Rendering: Once all registered handlers contributed their items, Windows 98 displayed the compiled menu using the Win32 TrackPopupMenuEx API. If owner-drawn items or submenus were present, messages like WM_INITMENUPOPUP or WM_DRAWITEM were routed back to the extension via IContextMenu2::HandleMenuMsg.
  4. Execution: When the user selected an item, the shell invoked IContextMenu::InvokeCommand, passing a structure containing the command's verb or menu identifier offset, prompting the handler to execute the requested action.

Windows 98 also introduced full integration with Internet Explorer 4.0's Shell Update Release, which added the Active Desktop layer. Because of this integration, the desktop was hosted by an updated desktop view component (IShellView) that automatically incorporated native Active Desktop commands—such as "Active Desktop", "Arrange Icons", and "Line Up Icons"—before aggregating external Registry-based context menu handlers.