(habe leider die PB demo)

Code: Alles auswählen
OpenConsole()
If InitCDAudio() = 0
MessageRequester("Error", "kein laufwerk gefunden", 0)
End
EndIf
eject$=Input()
If eject$="e"
EjectCDAudio(1)
EndIf
input()
Code: Alles auswählen
OpenConsole()
If InitCDAudio() = 0
MessageRequester("Error", "kein laufwerk gefunden", 0)
End
EndIf
eject$=Input()
If eject$="open"
UseCDAudio(0)
EjectCDAudio(1)
EndIf
If eject$="close"
UseCDAudio(0)
EjectCDAudio(0)
EndIf
input()
Code: Alles auswählen
#IOCTL_STORAGE_EJECT_MEDIA = $2D4808
#IOCTL_STORAGE_LOAD_MEDIA = $2D480C
If OpenLibrary(0,"Kernel32.dll")
LW.s = "F:"
;Functions
*CreateFile = IsFunction(0,"CreateFileA")
*DeviceIoControl = IsFunction(0,"DeviceIoControl")
*CloseHandle = IsFunction(0,"CloseHandle")
;Eject
hLwStatus = CallFunctionFast(*CreateFile,"\\.\"+LW,#GENERIC_READ|#GENERIC_WRITE, 0, 0, #OPEN_EXISTING, 0, 0)
If hLwStatus
CallFunctionFast(*DeviceIoControl,hLwStatus,#IOCTL_STORAGE_EJECT_MEDIA,0,0,0,0,@Ret,0)
CallFunctionFast(*CloseHandle,hLwStatus)
EndIf
;Load
hLwStatus = CallFunctionFast(*CreateFile,"\\.\"+LW,#GENERIC_READ|#GENERIC_WRITE, 0, 0, #OPEN_EXISTING, 0, 0)
If hLwStatus
CallFunctionFast(*DeviceIoControl,hLwStatus,#IOCTL_STORAGE_LOAD_MEDIA,0,0,0,0,@Ret,0)
CallFunctionFast(*CloseHandle,hLwStatus)
EndIf
CloseLibrary(0)
EndIf
Code: Alles auswählen
#IOCTL_STORAGE_EJECT_MEDIA = $2D4808
#IOCTL_STORAGE_LOAD_MEDIA = $2D480C
#GENERIC_READ = $80000000
#GENERIC_WRITE = $40000000
#OPEN_EXISTING = 3
If OpenLibrary(0,"Kernel32.dll")
LW.s = "F:"
;Functions
*CreateFile = IsFunction(0,"CreateFileA")
*DeviceIoControl = IsFunction(0,"DeviceIoControl")
*CloseHandle = IsFunction(0,"CloseHandle")
;Eject
hLwStatus = CallFunctionFast(*CreateFile,"\\.\"+LW,#GENERIC_READ|#GENERIC_WRITE, 0, 0, #OPEN_EXISTING, 0, 0)
If hLwStatus
CallFunctionFast(*DeviceIoControl,hLwStatus,#IOCTL_STORAGE_EJECT_MEDIA,0,0,0,0,@Ret,0)
CallFunctionFast(*CloseHandle,hLwStatus)
EndIf
;Load
hLwStatus = CallFunctionFast(*CreateFile,"\\.\"+LW,#GENERIC_READ|#GENERIC_WRITE, 0, 0, #OPEN_EXISTING, 0, 0)
If hLwStatus
CallFunctionFast(*DeviceIoControl,hLwStatus,#IOCTL_STORAGE_LOAD_MEDIA,0,0,0,0,@Ret,0)
CallFunctionFast(*CloseHandle,hLwStatus)
EndIf
CloseLibrary(0)
EndIf