DeviceRemovePending Event

       

Occurs after all applications have given approval to remove a device and the device is about to be removed.

Syntax

Private Sub object_DeviceRemovePending([index As Integer,] ByVal devicetype As Long, ByVal deviceid As Long, ByVal devicename As String, ByVal devicedata As Long, cancel As Boolean)

The DeviceRemovePending event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
index A numeric expression that evaluates to the index of a control if it is in a control array.
devicetype A value that indicates the type of device that has been added, as described in Settings.
deviceid A value that identifies the device, as described in Settings.
devicename Null for all settings of devicetype except DeviceTypePort. When devicetype is DeviceTypePort, then devicename is dbcp_name.
devicedata A value as described in Settings.
cancel A Boolean value, as described in Settings.

Settings

The settings for devicetype are:

Constant Value Description
DeviceTypeOEM 0 OEM-defined device type.
DeviceTypeDevNode 1 Devnode number (Windows 95).
DeviceTypeVolume 2 Logical volume (disk drive).
DeviceTypePort 3 Serial or parallel port.
DeviceTypeNet 4 Network resource

The settings for deviceid are:

devicetype Setting deviceid Setting
DeviceTypeOEM dbco_identifier
DeviceTypeDevNode dbcd_devnode
DeviceTypeVolume dbcv_unitmask
DeviceTypePort Null
DeviceTypeNet dbcn_resource

The settings for devicedata are:

devicetype Setting devicedata Setting
DeviceTypeOEM dbco_suppfunc
DeviceTypeDevNode Null
DeviceTypeVolume dbcv_flags
DeviceTypePort Null
DeviceTypeNet dbcn_flags

The settings for cancel are:

Setting Description
True The system is preventing the device from being removed.
False The system allows the device to be removed.