Results 1 to 13 of 13

Thread: Does c# have any alert features

Hybrid View

  1. #1
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Does c# have any alert features

    Beep:
    Code:
    Console.Beep();
    Console.Beep(int frequency, int duration);
    Flash window title/task bar button
    Code:
    using System.Runtime.InteropServices;
    
    struct FLASHWINFO
    {
        public int cbSize;
        public IntPtr hWnd;
        public int dwFlags;
        public int uCount;
        public int dwTimeout;
    }
    
    [DllImport("user32")] private static extern int FlashWindowEx (
        ref FLASHWINFO pwfi
    );
    
    const int FLASHW_STOP = 0;
    const int FLASHW_CAPTION = 0x1;
    const int FLASHW_TRAY = 0x2;
    const int FLASHW_ALL = 0x3;
    const int FLASHW_TIMER = 0x4;
    const int FLASHW_TIMERNOFG = 0xC;
    
    private void button1_Click (object sender, EventArgs e)
    {
        FLASHWINFO flashInfo = new FLASHWINFO();
        flashInfo.cbSize = Marshal.SizeOf(flashInfo);
        flashInfo.hWnd = this.Handle;
        flashInfo.dwFlags = FLASHW_ALL;
        flashInfo.uCount = 5;
        flashInfo.dwTimeout = 0;
    
        FlashWindowEx(ref flashInfo);
    }

  2. #2

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: Does c# have any alert features

    Sorry I didnt explain what I was looking for. All I want is to generate some kind of beeping noise or blinker when the user makes an error. At present I'm inputting all the user errors in a message box. Is there a way to create a beeping noise or some kind of other attraction that will get the user attention?

    Jennifer

  3. #3

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: Does c# have any alert features

    Penagate: Do you have to add any reference to use the Console.Beep? Cause I've been trying to use it but its not being recognized.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width