Open/Close DVD/CD drawer From A Clarion App

I’ve found a few free utilities which will open/eject the DVD drawer which can be called from a Clarion app. Is there a way to do this form clarion without resorting to external utilities?

                PROGRAM

                MAP
                    module('winapi')
                        mciSendString(*cstring lpszCommand,*cstring lpszReturnString,long cchReturn,long hCallBack),long,raw,pascal,name('mciSendStringA')
                    end
                END

result long
theCommand cstring(81)
theBuffer cstring(129)

CODE
    ! https://docs.microsoft.com/en-us/previous-versions/dd757161(v%3Dvs.85)
    theCommand = 'set CDAudio door open'    
    result = mciSendString(theCommand,theBuffer,size(theBuffer),0)
    !*** to close ***
    theCommand = 'set CDAudio door closed'
2 Likes

Above code tested OK in Clarion 11

Using mciSendString api I’m able to open DVD tray passing ‘set cdaudio door open’ as a command.

1 Like

Many thanks for the super-quick solutions.

1 Like

If only I still had a machine with a CD/DVD drive. I could totally impress the kids with such things!

Even better, a program for the turntable.

Hi David…
Clarion v5 or v55 have a examples of this…
Regards

Hi Roland,

Code I posted above (using mciSendString) will work with any version of Clarion.

1 Like

Graham’s code should work, I did the same thing (albeit with a difference MCI string) back in the mid-90’s with C5