Changing Mouse Settings With VB.NET

CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Curiosity killed the cat, meaning: being too curious can be dangerous. Why am I mentioning this? Well, I’m a curious person, I always want to know what makes something tick; in today’s lesson, you will say that I wanted to know what goes on behind the scenes when changing Mouse settings, how is it done, where are these settings? Those are just a few questions I will answer today. I will show you how to change all the Mouse settings through the use of your Visual Basic program and the Registry.

Highlights include:

  1. Changing Mouse Wheel settings
  2. Swap the Mouse buttons (Right handed/ Left Handed)
  3. Change double-click speed
  4. Click Lock
  5. Mouse Pointer Trails
  6. Mouse Pointer Shadows
  7. Snap to default button
  8. Hide the cursor while typing
  9. Mouse Pointer speed

Basically, all the settings are found in the Mouse control panel applet.

                 

The Design

I have designed my form to look like Figure 1. Feel free to give all objects your own descriptive names.

Figure 1: Design

The Coding

All the Mouse settings are stored in two main Registry keys:

  1. HKEY_CURRENT_USER\Control Panel\Desktop
  2. HKEY_CURRENT_USER\Control Panel\Mouse

To obtain these settings and to change them, you need to Import the Microsoft.Win32 namespace so that you can get access to all its Registry functions. You’ll start with the Mouse Wheel Scroll settings.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read