Skip to content

weedsboy/electron-mousehook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electron-mousehook

Electron mousehook for win.

You can receive mouse events in Windows system.

Must be called on the main thread.

Usage

//start MouseHook
const mousehook = require('electron-mousehook')
const result = mousehook.StartMouseHook(wnd)
if (result == 0) {
    console.log('startMouseHook Error.')
    return
}

win.hookWindowMessage(result, async (wParam, lParam) => {
    const event = wParam.readUInt32LE(0)
    if (event == 0x0200 || event == 0x00a0) {
        console.log('mouse move')
    } else if (event == 0x0201 || event == 0x00a1) {
        console.log('L down')
    } else if (event == 0x0202 || event == 0x00a2) {
        console.log('L up')
    }
})

//stop MouseHook
mousehook.StopMouseHook(wnd)

License

MIT, please see LICENSE for details. Copyright (c) 2021 weedsboy.

About

Electron mousehook for win.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published