Skip to content

aubreychao/Ikst.MouseHook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ikst.MouseHook

This is a library to realize global mouse hooks in .net windows applications.
Mouse events can be triggered for applications that do not have a screen, or for mouse operations outside of a window.
The events that can occur are as follows

  • MouseMove
  • MouseWheel
  • LeftButtonDown
  • LeftButtonUp
  • RightButtonDown
  • RightButtonUp
  • MiddleButtonDown
  • MiddleButtonUp

All events contain a MSLLHOOKSTRUCT structure.

usage

  • Create an instance and use the start method to start the hook.
  • The event is triggered by a mouse operation.
  • In the event, you can get the MSLLHOOKSTRUCT structure.

[e.g.] Display the mouse coordinates of the left click in the window title.

public partial class MainWindow : Window
{
    private readonly MouseHook mh = new MouseHook();

    public MainWindow()
    {
        InitializeComponent();

        mh.LeftButtonDown += (st) =>
        {
            this.Title = $"X:{st.pt.x} Y:{st.pt.y}";
        };

        mh.Start();
    }
}

nuget

https://www.nuget.org/packages/Ikst.MouseHook/

About

a global mouse hook library for .net windows application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%