一段代码吧://procedure TForm1.Button1Click(Sender: TObject); begin mciSendString('Set cdaudio door open wait', nil, 0, 0); end;procedure TForm1.Button2Click(Sender: TObject); begin mciSendString('Set cdaudio door close wait', nil, 0, 0); end;//打开光驱门,和关闭,但是我没有实现关闭的效果
mciSendString The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string. MCIERROR mciSendString( LPCTSTR lpszCommand, LPTSTR lpszReturnString, UINT cchReturn, HANDLE hwndCallback ); Parameters lpszCommand Pointer to a null-terminated string that specifies an MCI command string. For a list, see Multimedia Command Strings. lpszReturnString Pointer to a buffer that receives return information. If no return information is needed, this parameter can be NULL. cchReturn Size, in characters, of the return buffer specified by the lpszReturnString parameter. hwndCallback Handle to a callback window if the "notify" flag was specified in the command string. Return Values Returns zero if successful or an error otherwise. The low-order word of the returned DWORD value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see MCIERR Return Values.To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString function.
hehe^^ goomoo (古木) 你在做什么项目呀?? 每天差不多都能看到你问新问题....
我不要例子和帮助。我要mciSendString能够发送的所有命令的资料。 谢谢各位。
MCIERROR mciSendString( LPCTSTR lpszCommand, LPTSTR lpszReturnString, UINT cchReturn, HANDLE hwndCallback ); Parameters lpszCommand Address of a null-terminated string that specifies an MCI command string. For more information about the command strings, see Command Strings. lpszReturnString Address of a buffer that receives return information. If no return information is needed, this parameter can be NULL. cchReturn Size, in characters, of the return buffer specified by the lpszReturnString parameter. hwndCallback Handle of a callback window if the "notify" flag was specified in the command string. Return Values Returns zero if successful or an error otherwise. The low-order word of the returned doubleword value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see Constants: MCIERR Return Values.To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString
begin
mciSendString('Set cdaudio door open wait', nil, 0, 0);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
mciSendString('Set cdaudio door close wait', nil, 0, 0);
end;//打开光驱门,和关闭,但是我没有实现关闭的效果
The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string. MCIERROR mciSendString(
LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback
);
Parameters
lpszCommand
Pointer to a null-terminated string that specifies an MCI command string. For a list, see Multimedia Command Strings.
lpszReturnString
Pointer to a buffer that receives return information. If no return information is needed, this parameter can be NULL.
cchReturn
Size, in characters, of the return buffer specified by the lpszReturnString parameter.
hwndCallback
Handle to a callback window if the "notify" flag was specified in the command string.
Return Values
Returns zero if successful or an error otherwise. The low-order word of the returned DWORD value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see MCIERR Return Values.To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString function.
每天差不多都能看到你问新问题....
谢谢各位。
LPCTSTR lpszCommand,
LPTSTR lpszReturnString,
UINT cchReturn,
HANDLE hwndCallback
);
Parameters
lpszCommand
Address of a null-terminated string that specifies an MCI command string. For more information about the command strings, see Command Strings.
lpszReturnString
Address of a buffer that receives return information. If no return information is needed, this parameter can be NULL.
cchReturn
Size, in characters, of the return buffer specified by the lpszReturnString parameter.
hwndCallback
Handle of a callback window if the "notify" flag was specified in the command string.
Return Values
Returns zero if successful or an error otherwise. The low-order word of the returned doubleword value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see Constants: MCIERR Return Values.To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString
dim cmdToDo as string 'mciSendString能够发送的命令
1.Open:
Const WS_CHILD = &H40000000
cmdToDo = "open " & FileName & " type " & typeDevice & " Alias " & AliasName & " parent " & hWnd & " Style " & WS_CHILD
2.Pause:
cmdToDo="Pause " & AliasName
3.Play:
dim fromFrame as string '指定要播放的第一帧
dim toFrame as string '指定要播放的最后一帧
cmdToDo = "play " & AliasName & " from " & fromFrame & " to " & toFrame
4.FullScreen:
cmdToDo = "play " & AliasName & " FullScreen"
5.Resume:
cmdToDo="Resume " & AliasName
6.Close
cmdToDo="Close " & AliasName
cmdToDo="Close All"
7.SetVolume
' [Channel]
' 指定想要控制的声道,其取值为如下之一:
' Left 控制左声道
' Right 控制右声道
' All 控制左声道和右声道
' [VolumeValue]
' 指定所要控制声道的音量大小,其取值范围为从0到100.
cmdToDo = "setaudio " & AliasName & " " & Channel & " Volume to " & VolumeValue
8.stop:
cmdToDo = "stop " & AliasName
9.setChannels:
' [Channel]
' 指定想要控制的声道,其取值为如下之一:
' Left 控制左声道
' Right 控制右声道
' All 控制左声道和右声道
' [OnOrOFF]
' 指定所要控制声道的控制动作,其取值为如下之一:
' On 打开声道
' Off 关闭声道
cmdToDo = "set " & AliasName & " audio " & Channel & " " & ONOrOFF
10.Put:
[Left]不言而喻
[Top]不言而喻
[Width]不言而喻
[Height]不言而喻
cmdToDo="put " & AliasName & " window at " & Left & " " & Top & " " & Width & " " & Height
11.GetStatus
cmdToDo="status " & AliasName & " mode"
例子:
Dim Status As String
mciSendString "status " & AliasName & " mode", Status, 128, 0&
如成功执行,则status返回如下值之一:
stopped,playing,Paused
12.GetTotalFrames:
直接给个例子:
'这个模块用于计算要播放的多媒体文件总共包含的帧数
Public Function GetTotalFrames(AliasName As String) As Long
Dim sReturn As Long
Dim Total As String
sReturn = mciSendString("set " & AliasName & " time format frames", Total, 128, 0&)
sReturn = mciSendString("status " & AliasName & " length", Total, 128, 0&)
If Not sReturn = 0 Then
GetTotalFrames = -1
Exit Function
End If
GetTotalFrames = Val(Total)
End Function
够不够,不够还有.
我也正在找里面命令参数的内容,,,但MSDN上没有,,,,command string我也没找到