Funktionreferenz


_WinAPI_LockDevice


Enables or disables the mechanism that ejects media, for those devices possessing that locking capability

#include <WinAPIFiles.au3>
_WinAPI_LockDevice ( $sDrive, $bLock )

Parameter

$sDrive The drive letter of the device to enable or disable, in the format D:, E:, etc.
$bLock Specifies whether the device should be disabled, valid values:
    True - The device is disabled.
    False - The device is enabled.

Rückgabewert

Success: True.
Failure: False and sets the @error flag to non-zero.

Bemerkungen

This function is valid only for devices that support removable media.

Siehe auch

Suche nach IOCTL_STORAGE_MEDIA_REMOVAL in der MSDN Bibliothek.

Beispiel

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>

Local $aDrive = DriveGetDrive('CDROM')

If IsArray($aDrive) Then
    _WinAPI_LockDevice($aDrive[1], 1)
    MsgBox($MB_SYSTEMMODAL, '', 'Das Laufwerk (' & StringUpper($aDrive[1]) & ') ist gesperrt.')
    _WinAPI_LockDevice($aDrive[1], 0)
    MsgBox($MB_SYSTEMMODAL, '', 'Das Laufwerk (' & StringUpper($aDrive[1]) & ') ist nicht gesperrt.')
EndIf