主题:在C#中调用API函数mciSendCommand的几个问题
yylzq
[专家分:0] 发布于 2006-04-16 01:44:00
[DllImport("winmm.dll", EntryPoint="mciSendCommand")]
public static extern int mciSendCommand (
int wDeviceID,
int uMessage,
int dwParam1,
int dwParam2
);
我的电脑中有两个光驱,我想用这个函数来控制这两个光驱的打开和关闭。请问这几个参数是什么意思,应该怎样赋值?
回复列表 (共1个回复)
沙发
aaronwang [专家分:16870] 发布于 2006-04-24 13:55:00
没有MSDN吗???
mciSendCommand
The mciSendCommand function sends a command message to the specified MCI device.
MCIERROR mciSendCommand(
MCIDEVICEID IDDevice,
UINT uMsg,
DWORD fdwCommand,
DWORD_PTR dwParam
);
Parameters
IDDevice
Device identifier of the MCI device that is to receive the command message. This parameter is not used with the MCI_OPEN command message.
uMsg
Command message. For a list, see Multimedia Commands.
fdwCommand
Flags for the command message.
dwParam
Pointer to a structure that contains parameters for the command message.
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 return values, see MCIERR Return Values.
To retrieve a text description of mciSendCommand return values, pass the return value to the mciGetErrorString function.
Remarks
Error values that are returned when a device is being opened are listed with the MCI_OPEN command message. In addition to the MCI_OPEN error return values, this function can return the values listed in MCIERR Return Values.
Use MCI_OPEN to obtain the device identifier specified by the IDDevice parameter.
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later. Not supported in 64-bit versions.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.
See Also
MCI, MCI Functions, Command Messages, MCI_OPEN, mciGetErrorString
我来回复