Windows Key Binder - Create a Bindings manager application (C#/.NET)

Windows Key Binder - Create a Bindings manager application (C#/.NET)
Page content

This project made with .NET C# and Windows Forms. It allows people to bind commands and applications to Mouse input ( including side buttons).


Introduction

This project is directly linked to another project called “Lol Timers”. This project required to be able to launch an application with side button of my mouse but this feature seems not directly included in windows. That’s why I decided to create my own bindings manager.

Layout of Mouse Button

Development

This project will be made with .NET C# and Windows Forms.

Requirements:

  • Install Visual Studio with Windows Forms Components.
  • Install MouseKeyHook (With Nuget)

First UI

Animated Image which shows key detection

We create a first Windows Form in order to display which button is pressed



Code

Improve UI and Features

Let’s Improve UI in order to include add and remove binding features.

Main Form

Main Form which contains add and remove bind buttons and a list of registered bindings with linked application.



Add Bind Form which listen to pressed key and allows you to set an application with a file browser

Main Add Form


Bind Form Code

Variables:

image
  • SetKey and Set Application are used to send data between forms.
  • MouseHook is used to get mouse inputs.
  • BindDictionnary is used to get the binding key and the linked application.
Code to remove binding

Remove Bind Code: Get all checked box in the list and remove the binding both in the list and in the dictionary.



Code to detect mouse input

Detect Mouse Input: Everytime a mouse input is done, this method is triggers. It will check if an application is linked with the input key and launch it.




Results