DeviceArrival Event

       

Occurs when a new device is added to the system.

Syntax

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

The DeviceArrival 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.

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

Remarks

This event is very useful if your application can dynamically make use of new hardware.