Пример #1
0
 public static void MessageBeep(BeepTypes type)
 {
     if (!MessageBeep((UInt32)type))
     {
         Int32 err = Marshal.GetLastWin32Error();
         throw new Win32Exception(err);
     }
 }
Пример #2
0
        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" : "")
            };
        }
Пример #3
0
        /// <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);
 }
Пример #6
0
 /// <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();
     }
 }