Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 36755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:26:34+00:00 2026-05-10T14:26:34+00:00

The ‘click sound’ in question is actually a system wide preference, so I only

  • 0

The ‘click sound’ in question is actually a system wide preference, so I only want it to be disabled when my application has focus and then re-enable when the application closes/loses focus.

Originally, I wanted to ask this question here on stackoverflow, but I was not yet in the beta. So, after googling for the answer and finding only a little bit of information on it I came up with the following and decided to post it here now that I’m in the beta.

using System; using Microsoft.Win32;  namespace HowTo {     class WebClickSound     {         /// <summary>         /// Enables or disables the web browser navigating click sound.         /// </summary>         public static bool Enabled         {             get             {                 RegistryKey key = Registry.CurrentUser.OpenSubKey(@'AppEvents\Schemes\Apps\Explorer\Navigating\.Current');                 string keyValue = (string)key.GetValue(null);                 return String.IsNullOrEmpty(keyValue) == false && keyValue != '\'\'';             }             set             {                 string keyValue;                  if (value)                 {                     keyValue = '%SystemRoot%\\Media\\';                     if (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor > 0)                     {                         // XP                         keyValue += 'Windows XP Start.wav';                     }                     else if (Environment.OSVersion.Version.Major == 6)                     {                         // Vista                         keyValue += 'Windows Navigation Start.wav';                     }                     else                     {                         // Don't know the file name so I won't be able to re-enable it                         return;                     }                 }                 else                 {                     keyValue = '\'\'';                 }                  // Open and set the key that points to the file                 RegistryKey key = Registry.CurrentUser.OpenSubKey(@'AppEvents\Schemes\Apps\Explorer\Navigating\.Current', true);                 key.SetValue(null, keyValue,  RegistryValueKind.ExpandString);                 isEnabled = value;             }         }     } } 

Then in the main form we use the above code in these 3 events:

  • Activated
  • Deactivated
  • FormClosing

    private void Form1_Activated(object sender, EventArgs e) {     // Disable the sound when the program has focus     WebClickSound.Enabled = false; }  private void Form1_Deactivate(object sender, EventArgs e) {     // Enable the sound when the program is out of focus     WebClickSound.Enabled = true; }  private void Form1_FormClosing(object sender, FormClosingEventArgs e) {     // Enable the sound on app exit     WebClickSound.Enabled = true; } 

The one problem I see currently is if the program crashes they won’t have the click sound until they re-launch my application, but they wouldn’t know to do that.

What do you guys think? Is this a good solution? What improvements can be made?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:26:35+00:00Added an answer on May 10, 2026 at 2:26 pm

    I’ve noticed that if you use WebBrowser.Document.Write rather than WebBrowser.DocumentText then the click sound doesn’t happen.

    So instead of this:

    webBrowser1.DocumentText = '<h1>Hello, world!</h1>'; 

    try this:

    webBrowser1.Document.OpenNew(true); webBrowser1.Document.Write('<h1>Hello, world!</h1>'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.