Liberty BASIC Community Forum
« Open or Close DVD drive door per RyanJ »

Welcome Guest. Please Login or Register.
Nov 17th, 2017, 1:26pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Open or Close DVD drive door per RyanJ  (Read 422 times)
BeeTrap
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 21
xx Open or Close DVD drive door per RyanJ
« Thread started on: Jul 5th, 2017, 10:58pm »

RyanJ's thread:
http://libertybasic.conforums.com/index.cgi?board=public&action=display&num=1106859868
got me wondering. I have 2 DVD-writer drives and needed to be able to choose WHICH drive to open or close so....
Code:
'--- initiate variables, drive names and actions required ---
SetUpDriveF$ = "open F: type Cdaudio alias cd wait shareable"
SetUpDriveG$ = "open G: type Cdaudio alias cd wait shareable"

ToDoOpen$  = "set cd door open"
ToDoClose$ = "set cd door closed"

'-- NEED to do this IF you will access ANOTHER CD-drive during this program run.
'--- Otherwise the drive that was "set up" first remains as "set up" and
'---- "set up" of another drive just fails to occur.
'-->>>>  Probably wise to ALWAYS DO THIS prior exiting program!
WhichDriveReset$ = "close cd"           '--- was >>> "close all", worried that may cause problems

'--- set choices --------------------------------------------
'---- currently : "open CD Drive F:", see lines not REMed out

'--- chose which CD drive
 WhichDriveSetUp$ = SetUpDriveF$
' WhichDriveSetUp$ = SetUpDriveG$       '<<< currently REMed out

'--- chose action wanted
 WhichDo$ = ToDoOpen$
' WhichDo$ = ToDoClose$                 '<<< currently REMed out

'-----------------------------------------------------------------------------
'-- code could be reduced by putting these 3 "CallDll" into a Function or Sub.
'--- left here as-is for clarity.  Could be 1 "CallDll", only Diff is Var for first Pointer.
'-----------------------------------
'--- "SET UP" device "cd", a CD-Rom drive
    CallDll #winmm, "mciSendStringA",_
        WhichDriveSetUp$ As Ptr,_
                 "" As Ptr,_
                127 As Long, _
                  0 As Long,_
                Ret As Long

'--- perform required action, open tray door or close tray door
    CallDll #winmm, "mciSendStringA",_
        WhichDo$ As Ptr,_
              "" As Ptr,_
             127 As Long, _
               0 As Long,_
             Ret As Long

'--- reset MCI device "cd", alias for Cdaudio
    CallDll #winmm, "mciSendStringA",_
        WhichDriveReset$ As Ptr,_
                 "" As Ptr,_
                127 As Long, _
                  0 As Long,_
                Ret As Long

WAIT
END
 

Most of this, DLLs and API, etc is over my head, but this does work for me. Now I only need a reason to use it........
Curtis
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls