您的位置:首页 > 其它

WinAPI: MessageBeep - 播放一个系统声音

2009-08-20 16:22 429 查看
/// <summary>
/// 调用系统声音
/// </summary>
/// <param name="wType">类型</param>
/// <returns></returns>
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "MessageBeep")]
public static extern int MessageBeep(int wType);
//参数
//private const int MB_ICONASTERISK = 0x40;

private const int MB_ICONSTOP = 16; // Critical message; displays STOP icon.
private const int MB_ICONQUESTION = 32; // Warning query; displays ? icon.
private const int MB_ICONEXCLAMATION = 48; // Warning message; displays ! icon.
private const int MB_ICONINFORMATION = 64; // Information message; displays i icon.

private const int MB_OK = 0; // OK button only
private const int MB_OKCANCEL = 1; // OK and Cancel buttons
private const int MB_ABORTRETRYIGNORE = 2; // Abort, Retry, and Ignore buttons
private const int MB_YESNOCANCEL = 3; // Yes, No, and Cancel buttons
private const int MB_YESNO = 4; // Yes and No buttons
private const int MB_RETRYCANCEL = 5; // Retry and Cancel buttons

private const int MB_APPLMODAL = 0; // Application Modal Message Box
private const int MB_DEFBUTTON1 = 0; // First button is default
private const int MB_DEFBUTTON2 = 256; // Second button is default
private const int MB_DEFBUTTON3 = 512; // Third button is default
private const int MB_SYSTEMMODAL = 4096; // System Modal

private void button7_Click(object sender, EventArgs e)
{
MessageBeep(MB_ICONASTERISK);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: