How to play sound files or video files
The following is a method of performing an MCI directive to play a sound file through the MCISendstring function:
McInstring "Close C: /Windows/media/ding.wav", VBnullString, 0, 0 McIndstring "Open C: / WINDOWS/Media/ding.wav", vbnullstring, 0, 0 mcIndstring "Play C: / Windows / Media / Ding.wav ", vbnullstring, 0, 0 green part pay attention to lowercase
Before using the MCI directive, remember to close the MCI, when playing again next time
Play correctly, or change the location of the playback to the forefront, as follows:
McIndstring "Seek C: /Windows/media/ding.wav to start", vbnullstring, 0, 0 mcIndstring "Play C: /Windows/media/ding.wav", VBnullString, 0, 0
In addition, the other usage of seek is as follows:
SEEK Media Name To Start moves the location to the front Seek Media Name to End Move the location to the last SEEK media name to position to move the location to position
In addition to the sound file, how do you play the message file?
In fact, the MCI commands described above can be used in addition to playing the sound gear.
To play the MIDI gear and AVI file, you don't have to have any modifications, Windows will automatically generate one
You can play this video file in a window, but can you play in the specified location? The answer is
The method is as follows:
Open avi file name Parent HWnd Style Child where hwnd needs to fill in an object of HWnd
After performing the above command, the movie will be placed in the upper left corner of the object, and the size of the movie is not affected.
Impact of the size of the object, if you want to change the location of the movie and the size, you can execute
The PLAY instruction will perform the PUT command, the format is as follows:
PUT AVI Dialing Window At X Y [Width HEIGHT] where the X and Y parameters must be filled in position, and the Width and HEIGHT parameters fill in the width and height of the movie displayed.
Other common MCI commands:
PAUSE Equipment Name Pause Play STOP Device Name Stop Playing STEP Device Name Ad progress to the next position STEP device name Reverse After retreating to the last position STEP device name BY n forward or retreat N position (where n <0 is represented back) STATUS device name Position reads the current play position STATUS device name length Read the total length of the media
Tips:
In fact, we can add:
"API type" Alias Custom Media Device Name "
Open c: /windows/media/ding.wav Alias Mywav
The use of the above description is to take a relatively easy to get a C: /Windows/Media/ding.wav sound file.
The name of memory and writing, then in other MCI's instructions, it can be complicated.
C: /Windows/media/ding.wav is replaced with MYWAV, for example: