MessageBeep


MessageBeep

文章插图
MessageBeep【MessageBeep】MessageBeep函式用来播放一个波形声音 。
This function plays a waveform sound. (该函式是播放一段系统音乐)
基本介绍中文名:MessageBeep
性质:播放一个波形声音
返回值:Return Values
零表示不成功:Zero indicates failure
定义MessageBeep函式用来播放一个波形声音 。This function plays a waveform sound. (该函式是播放一段系统音乐)BOOL MessageBeep(UINT uType //根据不同的类型来定);Parameters(参数)uTypeSpecifies the sound type, as identified by an entry in the [sounds] section of the registry. It is one of the following values.Value Description (数值描述):0xFFFFFFFF SystemDefault (从机器的扬声器中发出蜂鸣声)MB_ICONASTERISK SystemAsterisk (播放由SystemAsterisk定义的声音)MB_ICONEXCLAMATION SystemExclamation (播放由SystemExclamation定义的声音)MB_ICONHAND SystemHand (播放由SystemHand定义的声音)MB_ICONQUESTION SystemQuestion (播放由SystemQuestion定义的声音)MB_OK SystemDefault (播放由SystemDefault定义的声音)Return Values(返回值):1.Nonzero indicates success. (非零表示成功)2.Zero indicates failure. (零表示不成功)3.To get extended error information, call GetLastError.(通过GetLastError函式来获取错误信息)Remarks(说明):After queuing the sound, the MessageBeep function returns control to the calling function and plays the sound asynchronously.If it cannot play the specified alert sound, MessageBeep attempts to play the system default sound. If it cannot play the system default sound, the function produces a standard beep sound through the computer speaker.The user can disable the warning beep by using the Sound Control Panel application.RequirementsOS Versions: Windows CE 1.0 and later.Header: Winbase.h.Link Library: Msgbeep.lib.See AlsoMessageBox程式示例#include<windows.h>int main(intargc,char*argv[]){    Sleep(1000);    ::MessageBeep(0xFFFFFFFF);//API函式前加“::”符号 , 表示这是一个全局的函式 , 以与c++类的成员函式相区分    Sleep(1000);    ::MessageBeep(MB_ICONASTERISK);    Sleep(1000);    ::MessageBeep(MB_ICONEXCLAMATION);    Sleep(1000);    ::MessageBeep(MB_ICONHAND);    Sleep(1000);    ::MessageBeep(MB_ICONQUESTION);    Sleep(1000);    ::MessageBeep(MB_OK);    Sleep(1000);    return0;}