启用或禁用具有锁定功能的设备的弹出媒体机制.
#Include <WinAPIEx.au3>
_WinAPI_LockDevice ( $sDrive, $fLock )
$sDrive | 设备驱动器号. 如 D:, E:, 等等. |
$fLock | 指定设备的启用或禁用, 有效值为: 1 - 禁用. 0 - 启用. |
成功: | 返回 1. |
失败: | 返回 0,并设置@error标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Drive = DriveGetDrive('CDROM')
If IsArray($Drive) Then
_WinAPI_LockDevice($Drive[1], 1)
MsgBox(0, '', 'The drive (' & StringUpper($Drive[1]) & ') is locked.')
_WinAPI_LockDevice($Drive[1], 0)
MsgBox(0, '', 'The drive (' & StringUpper($Drive[1]) & ') is unlocked.')
EndIf