弹出或收回 CD 或 DVD 驱动器的托盘(包括其他媒体设备)
; 使用期望的驱动器字母更新下面的第一行 (您可以忽略后面的其他所有行). Driveletter = I: ; 设置为您想弹出的驱动器字母. hVolume := DllCall("CreateFile" , Str, "\\.\" . Driveletter , UInt, 0x80000000 | 0x40000000 ; GENERIC_READ | GENERIC_WRITE , UInt, 0x1 | 0x2 ; FILE_SHARE_READ | FILE_SHARE_WRITE , UInt, 0 , UInt, 0x3 ; OPEN_EXISTING , UInt, 0, UInt, 0) if hVolume <> -1 { DllCall("DeviceIoControl" , UInt, hVolume , UInt, 0x2D4808 ; IOCTL_STORAGE_EJECT_MEDIA , UInt, 0, UInt, 0, UInt, 0, UInt, 0 , UIntP, dwBytesReturned ; 不使用. , UInt, 0) DllCall("CloseHandle", UInt, hVolume) }