CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2009
    Posts
    46

    [RESOLVED] KeyEvents

    Hi, i'm implementing some shortcut keys for a c# windows application, now whenever i press a shortcut key i hear background windows alert (beep) sounds, how can i avoid these beeps?

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: KeyEvents

    Is your application already doiong something (busy) when you press the shortcut key?

    Does the code you associate with the shortcut key (ie the Event Handler) get executed?
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

  3. #3
    Join Date
    Aug 2009
    Posts
    46

    Post Re: KeyEvents

    i'm making a windows.forms.form diag to appear whenever i press the shortcut key. for the first it works fine but when i press the key for the second time, the form diag appears with beep noise. when i use the mouse controls (context menu) to work with it then all everything goes well.

  4. #4
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: KeyEvents

    I just created a windows forms app. Created a context menu with one item on it "ShowDlg ctrl+s". Assigned the context menu to the form. Added a handler to the menu item to do a MessageBox.Show("Hello").

    Right click on the form with the mouse choose the menu option, the MessageBox appears with a beep.

    Close the MessageBox. Type ctrl+s and the message box appears with a beep.

    Seems both, in my case, beep. Not sure if this is because I am using the standard MessageBox and not my own dialog...
    Last edited by rliq; August 20th, 2009 at 09:39 PM.
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

  5. #5
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: KeyEvents

    Changed my app to display another windows form. This new form contains one button that is associated with the CancelButton property of the form.
    Code:
    private void showDlgToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Dlg d = new Dlg();  // Dlg is the name of the class of my new form
        d.ShowDialog();     // not d.Show() as this prevent the button from closing the form
    }
    Now it works perfectly in both cases, without sound. So it seems as though the standard message box makes a noise.

    Can you post your menu handler code....
    Last edited by rliq; August 20th, 2009 at 09:41 PM.
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

  6. #6
    Join Date
    Aug 2009
    Posts
    46

    Thumbs up Re: KeyEvents

    I've just figured that i was using the keyDown event on a docked ListView Control which needs to be linked with the main form. so when i was pressing a key it goes looking for that character in the list and returns a beep if it wasn't present in list.

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

Featured