public static void MessageBeep(BeepTypes type) { if (!MessageBeep((UInt32)type)) { Int32 err = Marshal.GetLastWin32Error(); throw new Win32Exception(err); } }
public static DisplayText Create(string text, DisplayTextReasons reason, BeepTypes beep) { Ensure.NotNull(text, nameof(text)); return new DisplayText { Text = text, Reason = reason, Beep = beep, Flags = new Flags(beep != BeepTypes.NoBeep ? "BEEP" : "") }; }
/// <summary> /// ���Ƕ�Win32 API����MessageBeep��һ����װ���� /// </summary> /// <param name="type"></param> public static void MessageBeep(BeepTypes type) { if (!Enum.IsDefined(typeof(BeepTypes), type)) { throw new ArgumentException("BeepType can not be recognized!"); } if (!MessageBeep((UInt32)type)) { // ���ʧ�ܣ�������Ĵ����룬 // ���׳���Ӧ��Win32�쳣 Int32 err = Marshal.GetLastWin32Error(); throw new Win32Exception(err); } }
static extern bool MessageBeep( BeepTypes beepType );
// not working on HTC Diamond2 public static void Beep( BeepTypes msg ) { MessageBeep(msg); }
/// <summary> /// Managed Wrapper for MessageBeep. /// Not strictly needed but it's a good idea to provide a wrapper /// whenever using native APIs to help manage change, report errors, etc /// </summary> public static void MessageBeep(BeepTypes beep) { if (!MessageBeep((UInt32)beep)) { ThrowLastError(); } }