C # Recording Using the mcisendstring method in winmm. dll

Source: Internet
Author: User
Mcisendstring Is used to play multimedia files API Command, which can be played MPEG, Avi, WAV, MP3, And so on.

This function has four parameters:
The first parameter is the command string to be sent. The string structure is :[ Command ] [ Device alias ] [ Command Parameters ].
Second parameter: the buffer zone of the returned information , Is a string variable with a specified size. .
Third parameter: buffer size , Is the length of the character variable .
Fourth parameter: callback method, usually set to zero
Return Value: if the function is successfully executed, zero is returned. Otherwise, an error is returned.Code

For details, refer to (http://www.cnblogs.com/zrx401558287/archive/2008/11/28/1343160.html)

 

First, introduce this API function in the code.

 

Code
[Dllimport ( " Winmm. dll " , Entrypoint =   " Mcisendstring " , Charset = Charset. Auto)]
Public   Static   Extern   Int Mcisendstring (
String Lpstrcommand,
String Lpstrreturnstring,
Int Ureturnlength,
Int Hwndcallback
);

 

Start the recording.

 

Code
Mcisendstring ( " Close movie " , "" , 0 , 0 );
Mcisendstring ( " Open New Type waveaudio alias movie " , "" , 0 , 0 );
Mcisendstring ( " Record movie " , "" , 0 , 0 );

 

Close the recording and save it to a file, such as c: \ 1.wav.

 

Code
Mcisendstring ( " Stop movie " , "" , 0 , 0 );
Mcisendstring ( " Save Movie J: \ 1.wav " , "" , 0 , 0 );
Mcisendstring ( " Close movie " , "" , 0 , 0 );

 

OK, very simple

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.