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(參數)
uType
Specifies 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.
Requirements
OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Msgbeep.lib.
See Also
MessageBox

程式示例

#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;}

相關詞條

熱門詞條

聯絡我們