111,129
社区成员
发帖
与我相关
我的任务
分享
public class Win32DLL
{
//电脑发出声音
[DllImport("kernel32.dll")]
public static extern bool Beep(int frequency, int duration);//参数指的是声音的频率和声音持续的时间
//播放一段系统音乐
[DllImport("user32.dll")]
public static extern bool MessageBeep(BeepType beepType);
//处理结构
[DllImport("kernel32.dll")]
public static extern bool GetSystemPowerStatus(ref SystemPowerStatus systemPowerStatus);
}
public enum BeepType
{
MB_OK = 0,
MB_ICONHAND = 16,
MB_ICONQUESTION = 32,
MB_ICONEXCLAMATION = 48,
MB_ICONASTERISK = 64,
}
protected void btnMessageBeep_Click(object sender, EventArgs e)
{
Win32DLL.MessageBeep(BeepType.MB_OK);
}