The pen driver must support a minimum set of required messages, which are listed in the table below.
Message | Description |
DRV_CLOSE | Sent by the CloseDriver Windows function to close the driver. |
DRV_CONFIGURE | Requests the driver to display its configuration dialog box. |
DRV_DISABLE | Sent when the system unloads the pen driver. |
DRV_ENABLE | Sent when the system loads the pen driver. |
DRV_FREE | Sent when the system unloads the pen driver. |
DRV_INSTALL | Informs the pen driver it should install itself on the system. The driver records the information the system needs at startup so that the next time Windows starts, the pen driver will be loaded. |
DRV_LOAD | Sent to the pen driver when it is first loaded. |
DRV_OPEN | Sent from the OpenDriver Windows function. |
DRV_QUERYCONFIGURE | Checks if the driver provides a configuration dialog box. |
DRV_REMOVE | Informs the pen driver it should uninstall itself from the system. The driver removes the information it recorded at startup and the references that the system uses to load the driver. The next time Windows starts, the pen driver will not be loaded. |
Note that a fully functioning pen driver also supports the DRV_SetEntryPoints and DRV_RemoveEntryPoints messages. However, the pen driver can be used like a mouse driver, updating the pen cursor location, without supporting these two messages.
The pen driver must handle the standard messages that are sent to any installable Windows driver. Many of these standard messages have a counterpart message with a reverse effect-DRV_CLOSE is the counterpart of DRV_OPEN, for example. The following sections briefly describe the effects of each of the standard message pairs. At the end of this section, a table lists all the DRV_ messages recognized by the pen driver and gives a summary description of each message. For more complete descriptions of each of these required standard messages, see the "Reference" section.
These two messages are the first and last messages an installable driver receives. When processing DRV_LOAD, the pen driver reads configuration information from the Windows 95 registry, configures associated hardware, and allocates memory if required.
To process DRV_FREE, the pen driver frees any allocations and notifies the virtual pen driver that the pen driver is being unloaded.
The pen driver receives the DRV_OPEN message whenever a process opens the pen driver by calling the Windows OpenDriver function. The pen driver receives DRV_CLOSE when the process calls CloseDriver to close the driver.
When the pen driver receives DRV_ENABLE, it performs system operations such as hooking interrupts, initializing hardware, and so forth. It also calls the virtual pen driver to notify it to start sending pen packet information. Note that the tablet is in its default state at this point, having been set by the virtual device driver when it was initialized.
The DRV_DISABLE message reverses the process, telling the pen driver to restore the system back to its original state. When processing this message, the pen driver calls the virtual pen driver stop sending pen packet information.
The pen driver exists in memory between the DRV_ENABLE and DRV_DISABLE messages. The driver receives these messages only once during loading and unloading.
The DRV_INSTALL and DRV_REMOVE messages request the control panel to install, configure, and remove a driver from the system.
The pen driver responds to the DRV_QUERYCONFIGURE message by reporting whether or not it provides a custom-configuration dialog box. The sample pen driver does provide a pen configuration dialog box by calling PENUI.DLL. The custom-configuration dialog box is implemented by the source code in the \PEN\SAMPLES\PENUI directory, which produces PENUI.DLL.
The driver responds to the DRV_CONFIGURE message by displaying the custom-configuration dialog box.