aardio 文档

win.util.deviceNotification 库模块帮助文档

win.util 成员列表

win.util.deviceNotification

设备检测

win.util.deviceNotification()

返回对象:winDeviceNotificationObject

win.util.deviceNotification(输入winform对象)

创建一个设备通知窗口
在添加或移除设备时可响应通知消息
可选使用参数@2指定GUID

winDeviceNotificationObject 成员列表

winDeviceNotificationObject.onDeviceArrival

winDeviceNotificationObject.onDeviceArrival = function(devType,devData,pDevData){
    if( devType == 2/*_DBT_DEVTYP_VOLUME*/ ){
        if( devData.isMedia ){
            io.print("插入光盘",devData.drives[1] )
        }
        elseif( devData.isNet ){
            io.print("添加网络卷",devData.drives[1])
        }
        else {
            io.print("添加磁盘",devData.drives[1])
        }
    }
}

winDeviceNotificationObject.onDeviceQueryRemove

winDeviceNotificationObject.onDeviceQueryRemove = function(devType,devData,pDevData){

}

winDeviceNotificationObject.onDeviceQueryRemoveFailed

winDeviceNotificationObject.onDeviceQueryRemoveFailed = function(devType,devData,pDevData){

}

winDeviceNotificationObject.onDeviceRemoveComplete

winDeviceNotificationObject.onDeviceRemoveComplete = function(devType,devData,pDevData){
    if( devType == 2/*_DBT_DEVTYP_VOLUME*/ ){
        if( devData.isUsbDevice ){
            io.print("移除U盘",devData.drives[1])
        }
    }
}

winDeviceNotificationObject.onDeviceRemovePending

winDeviceNotificationObject.onDeviceRemovePending = function(devType,devData,pDevData){

}

winDeviceNotificationObject.onDeviceTypeSpecific

winDeviceNotificationObject.onDeviceTypeSpecific = function(devType,devData,pDevData){

}

winDeviceNotificationObject.onVolumeArrival

winDeviceNotificationObject.onVolumeArrival = function(devData,pDevData){
    if( devData.isMedia ){
        io.print("插入光盘",devData.drives[1] )
    }
    elseif( devData.isNet ){
        io.print("添加网络卷",devData.drives[1])
    }
    elseif(sys.storage.isUsbDevice(devData.drives[1])){
        io.print("插入U盘",devData.drives[1] )
    }
}

winDeviceNotificationObject.onVolumeRemoveComplete

winDeviceNotificationObject.onVolumeRemoveComplete = function(devData,pDevData){
    io.print("移除:",devData.drives[1])
}

自动完成常量

_BROADCAST_QUERY_DENY=0x424D5144
_DBT_DEVICEARRIVAL=0x8000
_DBT_DEVICEQUERYREMOVE=0x8001
_DBT_DEVICEQUERYREMOVEFAILED=0x8002
_DBT_DEVICEREMOVECOMPLETE=0x8004
_DBT_DEVICEREMOVEPENDING=0x8003
_DBT_DEVICETYPESPECIFIC=0x8005
_DBT_DEVTYP_DEVICEINTERFACE=5
_DBT_DEVTYP_DEVINST=7
_DBT_DEVTYP_DEVNODE=1
_DBT_DEVTYP_HANDLE=6
_DBT_DEVTYP_NET=4
_DBT_DEVTYP_OEM=0
_DBT_DEVTYP_PORT=3
_DBT_DEVTYP_VOLUME=2
_WM_DEVICECHANGE=0x0219

Markdown 格式