📄 mciapi.h
字号:
////////////
//mciapi.h : v0020
//writen by : Liu Gang(0020), Xie Shen(v0010)
//complier : Microsoft Visual C++ 4.2
//v0010 : Sep.12.1995
//v0020 : Feb.9.1997
//v0021 : Aug.14.1997
////////////
// header file
#ifndef __MCIAPI_H__
#define __MCIAPI_H__
#include <mmsystem.h> // Multimedia functions support
#include <digitalv.h> // digital video support, avi only
// defines
////////////
#define MCI_ERROR_ID 900 // error id
// size of error message string
#define MCI_STRINGSIZE 129
// for play avi in full screen mode
#define MCI_MCIAVI_PLAY_FULLSCREEN 0x02000000L
////////////
////////////
//AVI animation functions
////////////
// open avi file
// hwnd : window for avi file to play on and receive error message
// filename : avi file name, must with full path and extension
// lpRect : display rectangle on desination window
// if NULL, display it with its origional size
// and the topleft on destination window is (0,0)
// if right and bottom is 0, the functions will use
// left and top as topleft position on destinaiton window
// 如果为空,在目的窗口的左上角按原大小播放AVI
// 如果right和bottom分量都是0,则以left和top分量为左上角原大小播放AVI
// return : -1 if failed, others to be the handle of avi file
// 失败则返回-1,否则返回avi文件的句柄
int MCI_AVI_Open(HWND hwnd,LPSTR filename,CONST RECT *lpRect=NULL);
// play avi file
// hwnd : window for avi file to play on and receive error message
// videoID : handle of avi object that previously opened, if it is -1, do nothing
// dwCommand: command for play, usually be MCI_WAIT, MCI_NOTIFY, and/or MCI_AVI_PLAY_FULLSCREEN
// when using MCI_WAIT, the function will not returned until end playing.
// when using MCI_NOTIFY, the function returned at once, when finished playing the
// object will send a MM_MCINOTIFY message to the window,
// you can close it on receiving this message
// 当使用MCI_WAIT参数时,函数要等AVI播放完才能返回
// 使用MCI_NOTIFY时,函数马上返回,当播放完时,会发出一个消息MM_MCINOTIFY,
// 在响应该消息时,可以关闭该文件。
// 注意,当使用MCI_AVI_Stop()函数终止播放时,也会发出该消息
// dwFrom : frame number to be played from
// dwTo : frame number to be played to, if both zero, play it from beginning to end.
// return : TRUE if played
BOOL MCI_AVI_Play(HWND hwnd,int videoID,DWORD dwCommand=MCI_NOTIFY, DWORD dwFrom=0, DWORD dwTo=0);
// seek in avi file
// hwnd : window for avi file to play on and receive error message
// videoID : handle of avi object that previously opened, if it is -1, do nothing
// dwCommand: command for seek, usually be MCI_WAIT, MCI_SEEK_TO_START
// return : TRUE if seeked
BOOL MCI_AVI_Seek(HWND hwnd,int videoID,DWORD dwCommand=MCI_WAIT|MCI_SEEK_TO_START,DWORD dwTo=0);
// stop avi file
// hwnd : window for avi file to play on and receive error message
// videoID : handle of avi object that previously opened, if it is -1, do nothing
// return : TRUE if stoped the avi
BOOL MCI_AVI_Stop(HWND hwnd,int videoID);
// pause avi file
// hwnd : window for avi file to play on and receive error message
// videoID : handle of avi object that previously opened, if it is -1, do nothing
// return : TRUE if stoped the avi
BOOL MCI_AVI_Pause(HWND hwnd,int videoID);
// close avi file
// videoID : handle of avi object that previously opened, if it is -1, do nothing
// return : TRUE if closed the file
BOOL MCI_AVI_Close(int videoID);
////////////
////////////
// midi functions
////////////
// open midi file
// hwnd : window for midi file to play on and receive error message
// filename : midi file name, must with full path and extension
// return : -1 if failed, others to be the handle of midi file
// 失败则返回-1,否则返回midi文件的句柄
int MCI_MIDI_Open(HWND hwnd,LPSTR filename);
// play midi file
// hwnd : window for midi file to play on and receive error message
// midiID : handle of midi object that previously opened, if it is -1, do nothing
// dwCommand: command for play, usually be MCI_WAIT, MCI_NOTIFY
// when using MCI_WAIT, the function will not returned until end playing.
// when using MCI_NOTIFY, the function returned at once, when finished playing the
// object will send a MM_MCINOTIFY message to the window,
// you can close it on receiving this message
// 当使用MM_WAIT参数时,函数要等MIDI播放完才能返回
// 使用MM_NOTIFY时,函数马上返回,当播放完时,会发出一个消息MM_MCINOTIFY,
// 在响应该消息时,可以关闭该文件。
// 注意,当使用MCI_MIDI_Stop()函数终止播放时,也会发出该消息
// return : TRUE if played the file
BOOL MCI_MIDI_Play(HWND hwnd,int midiID,DWORD dwCommand=MCI_NOTIFY);
// seek midi file, not done yet
// hwnd : window for midi file to play on and receive error message
// midiID : handle of midi object that previously opened, if it is -1, do nothing
// dwCommand: command for seek, usually be MCI_WAIT, MCI_SEEK_TO_START
// return : TRUE if seeked the file
BOOL MCI_MIDI_Seek(HWND hwnd,int midiID,DWORD dwCommand=MCI_WAIT|MCI_SEEK_TO_START);
// stop midi file
// hwnd : window for midi file to play on and receive error message
// midiID : handle of midi object that previously opened, if it is -1, do nothing
// return : TRUE if stoped the file
BOOL MCI_MIDI_Stop(HWND hwnd,int midiID);
// close midi file
// midiID : handle of midi object that previously opened, if it is -1, do nothing
// return : TRUE if closed the file
BOOL MCI_MIDI_Close(int midiID);
////////////
////////////
// wave functions
////////////
// open wave file
// hwnd : window for wave file to play on and receive error message
// filename : wave file name, must with full path and extension
// return : -1 if failed, others to be the handle of wave file
// 失败则返回-1,否则返回wave文件的句柄
int MCI_WAV_Open(HWND hwnd,LPSTR filename);
// play wave file
// hwnd : window for wave file to play on and receive error message
// waveID : handle of wave object that previously opened, if it is -1, do nothing
// dwCommand: command for play, usually be MCI_WAIT, MCI_NOTIFY
// when using MCI_WAIT, the function will not returned until end playing.
// when using MCI_NOTIFY, the function returned at once, when finished playing the
// object will send a MM_MCINOTIFY message to the window,
// you can close it on receiving this message
// 当使用MM_WAIT参数时,函数要等WAV播放完才能返回
// 使用MM_NOTIFY时,函数马上返回,当播放完时,会发出一个消息MM_MCINOTIFY,
// 在响应该消息时,可以关闭该文件。
// 注意,当使用MCI_WAV_Stop()函数终止播放时,也会发出该消息
// return : TRUE if played the file
BOOL MCI_WAV_Play(HWND hwnd,int waveID,DWORD dwCommand=MCI_NOTIFY);
// seek wave file
// hwnd : window for wave file to play on and receive error message
// waveID : handle of wave object that previously opened, if it is -1, do nothing
// dwCommand: command for seek, usually be MCI_WAIT, MCI_SEEK_TO_START
// return : TRUE if seeked the file
BOOL MCI_WAV_Seek(HWND hwnd,int waveID,DWORD dwCommand=MCI_WAIT|MCI_SEEK_TO_START);
// stop wave file
// hwnd : window for wave file to play on and receive error message
// waveID : handle of wave object that previously opened, if it is -1, do nothing
// return : TRUE if stoped the file
BOOL MCI_WAV_Stop(HWND hwnd,int waveID);
// close wave file
// waveID : handle of wave object that previously opened, if it is -1, do nothing
// return : TRUE if closed the file
BOOL MCI_WAV_Close(int waveID);
////////////
////////////
// CD Audio functions
////////////
// open CDAudio by track
// hwnd : window for wave file to play on and receive error message
// return : -1 if failed, others to be the handle of wave file
// 失败则返回-1,否则返回wave文件的句柄
int MCI_CDAUDIO_Open(HWND hwnd);
// play audio file
// hwnd : window for wave file to play on and receive error message
// cdaudioID : handle of wave object that previously opened, if it is -1, do nothing
// dwCommand: command for play, usually be MCI_WAIT, MCI_NOTIFY
// when using MCI_WAIT, the function will not returned until end playing.
// when using MCI_NOTIFY, the function returned at once, when finished playing the
// object will send a MM_MCINOTIFY message to the window,
// you can close it on receiving this message
// 当使用MM_WAIT参数时,函数要等CDAudio播放完才能返回
// 使用MM_NOTIFY时,函数马上返回,当播放完时,会发出一个消息MM_MCINOTIFY,
// 在响应该消息时,可以关闭该文件。
// 注意,当使用MCI_CDAUDIO_Stop()函数终止播放时,也会发出该消息
// dwFrom : track number to be played from, 1 if the first track
// dwTo : track number to be played to, if both zero, play it from beginning to end.
// return : TRUE if played the file
BOOL MCI_CDAUDIO_Play(HWND hwnd,int cdaudioID,DWORD dwCommand=MCI_NOTIFY,DWORD dwFrom=0,DWORD dwTo=0);
// seek audio file
// hwnd : window for wave file to play on and receive error message
// cdaudioID : handle of wave object that previously opened, if it is -1, do nothing
// dwCommand: command for seek, usually be MCI_WAIT, MCI_SEEK_TO_START
// nTrack : Track number to seek
// return : TRUE if seeked the file
BOOL MCI_CDAUDIO_Seek(HWND hwnd,int cdaudioID, int nTrack, DWORD dwCommand=MCI_WAIT|MCI_SEEK_TO_START);
// stop audio file
// hwnd : window for wave file to play on and receive error message
// cdaudioID : handle of wave object that previously opened, if it is -1, do nothing
// return : TRUE if stoped the file
BOOL MCI_CDAUDIO_Stop(HWND hwnd,int cdaudioID);
// close audio file
// cdaudioID : handle of wave object that previously opened, if it is -1, do nothing
// return : TRUE if closed the file
BOOL MCI_CDAUDIO_Close(int cdaudioID);
////////////
////////////
// globals
extern BOOL MCI_bEnableAVI;
extern BOOL MCI_bEnableMIDI;
extern BOOL MCI_bEnableWAV;
extern BOOL MCI_bEnableCDAUDIO;
////////////
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -