Tutorial: Using MenuBox on AutoRun CDs and DVDs
Q: How does an AutoRun CD work? How is MenuBox used in this context?
AutoRun is a feature of the Microsoft Windows operating system which makes it possible to automatically run a program (e.g. a menu window, a setup procedure, etc.) when a medium is inserted in the drive. Originally designed to launch CD-ROM-based applications, AutoRun also works on DVD-ROMs and other media. Support for AutoRun is a requirement of "Windows Logo" programs since Windows 95. MenuBox can not only be used as the application which opens a menu when the medium is inserted in the drive, but it also extends the original AutoRun specification (which covers the running of programs, not the opening of specific documents) by allowing non-program files such as HTML, PDF, PowerPoint, etc. to be automatically opened when the medium is inserted in the drive.
At the same time, because AutoRun may have been disabled on a system, MenuBox can be used to also provide intuitive manual access, without cluttering the root of the medium with unnecessary files.
When a medium is inserted in an AutoRun-enabled drive, the system looks for a file named "autorun.inf", which has to be stored at the root of the medium (i.e. it cannot be inside a directory). The file is structured following a simplified INI file format (the format used by MenuBox for its own configuration files). Most AutoRun-related needs are fully covered by setting just one or two keys (Open and Icon) in the [AutoRun] section of the "autorun.inf" file, which can be edited with a simple program like Notepad.
The Open and Icon keys work on all versions of Windows (Windows 95 and higher). The leading path information and the trailing command line options in the Open key are optional. If you use the Icon key we recommend that, for best results, you make sure that the icon file contains images in the most popular formats (ready for use on different display resolutions and icon size settings), which are 16x16, 32x32 and 48x48 pixels.
Adding [MenuBox] to Autorun.inf
The AutoRun specification allows for additional INI sections, which are ignored when they are not recognized. This behavior has been used several times by Microsoft to extend the functionality of AutoRun, while maintaining compatibility with older systems (even Windows 95 can handle unknown sections in autorun.inf).
Normally, you would place the "menubox.exe" file on your medium, adding a matching "menubox.ini" file that tells MenuBox what to do (which other files to open, etc.) You can rename both files, as long as their names match. For example, to make it intuitive for users who manually browse the your medium, you may want to rename "menubox.exe" to "AutoRun.exe" or "ClickMeToStart.exe". However, you would normally have to add the matching INI file in the same directory ("ClickMeToStart.ini", etc.) While this is just one more file, you may prefer to keep the files at the root to a minimum, so the directory is cleaner and it is more immediately understandable to the user which files could be of interest. This can be done by placing a reference to another directory, containing the MenuBox INI file and possible all other files used by MenuBox, in a [MenuBox] section directly inside "autorun.inf". Because "autorun.inf" already has to exist on an AutoRun-enabled medium, no new files are added.
Adding [MenuBox] directly inside "autorun.inf" is entirely optional. However, this slightly unclutters the root of the medium in a way that will be appreciated by casual and technical users alike.
In the following example "menubox.exe" (the MenuBox executable) and "menubox.ini" (the MenuBox configuration file) are stored at the root of the medium (i.e. together with "autorun.inf") and the behavior of MenuBox is defined in detail in the MenuBox configuration file (which is opened automatically when MenuBox is launched with no command line options).
The following example additionally assigns an icon to the medium and groups the MenuBox executable and configuration file, plus the icon file, in a subdirectory named "AutoRun" (this could be any other name, e.g. "MenuBox", etc.)
[AutoRun] Open=AutoRun\MenuBox.exe Icon=AutoRun\MyCD.ico
In the following example, "MenuBox.exe" is renamed "AutoRun.exe", and a reference to the MenuBox directory (containing the icon file and all MenuBox files except for the executable) is added to the "autorun.inf" file itself. This results in a cleaner and user-friendly root, where "AutoRun.exe" can be started manually by the user even if AutoRun is disabled.
[AutoRun] Open=AutoRun.exe Icon=MenuBox\MyCD.ico [MenuBox] Directory=MenuBox
The following example uses the MenuBox command line functionality, rather than a MenuBox configuration file, to open an HTML file using the default browser installed on the system. Command line mode is very easy to use, but it cannot be used to check if a viewer is installed and install it if necessary. (Note: although this example uses an external browser, HTML documents can also be opened inside MenuBox.)
[AutoRun] Open=AutoRun\MenuBox.exe Docs\index.html
The following example uses the MenuBox command line functionality to open a PowerPoint presentation, making sure that the current directory is changed first, so that relative links from the first PowerPoint file to other files in the same directory will work properly (be sure to also enable the "Use relative path for hyperlink" option in PowerPoint).
[AutoRun] OPEN=MenuBox\MenuBox.exe /d:powerpoint presentation.pps
The above example can be applied in a similar way to other types of documents (e.g. PDF, Excel, Word, etc.), but in all cases it does not check whether the system is actually capable of displaying these documents. MenuBox includes powerful functionality to check whether an appropriate viewer/player is installed, and, if not, to install the required software (which can be included on your medium) before proceeding. This functionality cannot be expressed in a single command line, and is therefore available through the configuration file.
The AutoRun specification covers additional features (e.g. support for different CPU platforms, drive label and shortcut menus, handling of removable devices, installation of drivers, event handlers, etc.) which in part require a specific minimum version of Windows (e.g. Windows XP, Windows for Automotive, etc.) and which are beyond the scope of this documentation. Also, the default behavior of AutoRun (i.e. if it should be enabled in general and/or on specific drives) can be modified via the Control Panel, programmatically, or via the registry.
For additional information please refer to the MenuBox documentation.
It is safe to link to this page.