Virtual Devices (3.1) (vdag31qh.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Begin_Control_Dispatch
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
include vmm.inc
 
Begin_Control_Dispatch DeviceName
 
The Begin_Control_Dispatch macro builds a table for dispatching messages
passed to the control procedure for the specified virtual device. This macro
is used in conjunction with the Control_Dispatch and End_Control_Dispatch
macros.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
DeviceName  Specifies the name of the virtual device. The macro uses this
            parameter to construct the label for the control procedure
            (appends _Control to the end of this name). This control
            procedure label must also be specified in the
            Declare_Virtual_Device macro
 
Return Value
 
This macro has no return value.
 
Comments
 
The Control_Dispatch macro can be used without Begin_Control_Dispatch, but
then it the programmer's responsibility to declare a procedure in locked
code (VxD_LOCKED_CODE_SEG) and clear the carry flag for any messages not
processed. The advantage in using Begin_Control_Dispatch macro is when a
large number of messages are processed by a device. The macro builds a jump
table which usually requires less code then the sequence of compare and jump
instructions that are generated when Control_Dispatch is used alone.
 
Example
 
The following example builds a complete dispatch table for the virtual
device named MyDevice:
 
Begin_Control_Dispatch MyDevice
Control_Dispatch  Device_Init, MyDeviceInitProcedure
Control_Dispatch  Sys_VM_Init, MyDeviceSysInitProcedure
Control_Dispatch  Create_VM,   MyDeviceCreateVMProcedure
End_Control_Dispatch MyDevice
 
See Also
 
Control_Dispatch, Declare_Virtual_Device, End_Control_Dispatch