CDドアの開閉 <TOP>
CDドアの開閉を実行します。API・F-BASICコマンドの両方をテストしています。
mciSendString MCIデバイスにコマンド文字列を送信
mciExecute MCIにアクセス
'================================================================ '= CDドアの開閉 '================================================================ #include "Windows.bi" ' 文字列を MCI に送信 Declare Function Api_mciSendString& Lib "winmm" Alias "mciSendStringA" (ByVal lpstrCommand$, ByVal lpstrReturnString$, ByVal uReturnLength&, ByVal hwndCallback&) ' MCIにアクセス Declare Function Api_mciExecute& Lib "winmm" Alias "mciExecute" (ByVal lpstrCommand$) Var Shared Mci As Object Mci.Attach GetDlgItem("MCI1") '================================================================ '= APIでDoor Open '================================================================ Declare Sub Button1_on edecl () Sub Button1_on() Var Ret As Long Ret = Api_mciSendString("set CDAudio door open", ByVal 0, 0, 0) End Sub '================================================================ '= APIでDoor Close '================================================================ Declare Sub Button2_on edecl () Sub Button2_on() Var Ret As Long Ret = Api_mciSendString("set CDAudio door closed", ByVal 0, 0, 0) End Sub '================================================================ '= F-BASICでDoor Open '================================================================ Declare Sub Button3_on edecl () Sub Button3_on() Mci.SendString "Open CDAudio Alias CDDevice wait" Mci.SendString "Set CDDevice Door Open wait" Mci.SendString "Close CDDevice" End Sub '================================================================ '= F-BASICでDoor Close '================================================================ Declare Sub Button4_on edecl () Sub Button4_on() Mci.SendString "Open CDAudio Alias CDDevice wait" Mci.SendString "Set CDDevice Door Closed wait" Mci.SendString "Close CDDevice" End Sub '================================================================ '= APIでDoor Open '================================================================ Declare Sub Button5_on edecl () Sub Button5_on() Var Ret As Long Ret = Api_mciExecute("set CDAudio door open") End Sub '================================================================ '= APIでDoor Close '================================================================ Declare Sub Button6_on edecl () Sub Button6_on() Var Ret As Long Ret = Api_mciExecute("set CDAudio door closed") End Sub '================================================================ '= '================================================================ While 1 WaitEvent Wend Stop End