Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RegisterHotKey (global hotkey support) #24

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ec130ea
Add RegisterHotKey (global hotkey support)
bibainet Sep 28, 2016
3cc0ab8
Merge branch 'master' of https://github.com/lxn/win
bibainet Jul 31, 2017
d705b84
Merge branch 'master' of https://github.com/lxn/win
bibainet Sep 14, 2017
b76fd47
Add .gitattributes
bibainet Sep 14, 2017
4326545
Merge branch 'master' of https://github.com/lxn/win
bibainet Oct 6, 2017
bd59939
Merge branch 'master' of https://github.com/lxn/win
bibainet Nov 7, 2017
cf9f937
Merge branch 'master' of https://github.com/lxn/win
bibainet Nov 7, 2017
5fd387b
Merge branch 'master' of https://github.com/lxn/win
bibainet Feb 27, 2018
3b7bacb
Merge branch 'master' of https://github.com/lxn/win
bibainet May 23, 2018
0cf6fb9
Merge branch 'master' of https://github.com/lxn/win
bibainet Sep 1, 2018
246cd54
Merge branch 'master' of https://github.com/lxn/win
bibainet Aug 22, 2019
1dc5832
user32.go fix
bibainet Aug 22, 2019
80e645c
Merge branch 'master' of https://github.com/lxn/win
bibainet Nov 12, 2019
0557296
Merge branch 'master' of https://github.com/lxn/win
bibainet Jun 23, 2020
837c7ff
Merge branch 'master' of https://github.com/lxn/win
bibainet Feb 12, 2021
b127f01
Merge branch 'master' of https://github.com/lxn/win
bibainet Feb 26, 2021
5e64684
Bump golang.org/x/sys from 0.0.0-20201018230417-eeed37f84f13 to 0.1.0
dependabot[bot] Feb 25, 2023
36ca2f1
Merge remote-tracking branch 'lxn/dependabot/go_modules/golang.org/x/…
bibainet Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
* eol=lf

*.cmd eol=crlf
*.bat eol=crlf

*.syso binary
*.gif binary
*.png binary
*.jpg binary
*.ico binary
*.zip binary
*.ttf binary
*.otf binary
*.woff binary
*.eot binary
*.pdf binary
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/lxn/win

go 1.12

require golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13
require golang.org/x/sys v0.1.0
13 changes: 13 additions & 0 deletions user32.go
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,7 @@ var (
postQuitMessage *windows.LazyProc
redrawWindow *windows.LazyProc
registerClassEx *windows.LazyProc
registerHotKey *windows.LazyProc
registerRawInputDevices *windows.LazyProc
registerWindowMessage *windows.LazyProc
releaseCapture *windows.LazyProc
Expand Down Expand Up @@ -2012,6 +2013,7 @@ func init() {
postQuitMessage = libuser32.NewProc("PostQuitMessage")
redrawWindow = libuser32.NewProc("RedrawWindow")
registerClassEx = libuser32.NewProc("RegisterClassExW")
registerHotKey = libuser32.NewProc("RegisterHotKey")
registerRawInputDevices = libuser32.NewProc("RegisterRawInputDevices")
registerWindowMessage = libuser32.NewProc("RegisterWindowMessageW")
releaseCapture = libuser32.NewProc("ReleaseCapture")
Expand Down Expand Up @@ -3091,6 +3093,17 @@ func RegisterClassEx(windowClass *WNDCLASSEX) ATOM {
return ATOM(ret)
}

func RegisterHotKey(hwnd HWND, id int, fsModifiers, vk uint) bool {
ret, _, _ := syscall.Syscall6(registerHotKey.Addr(), 4,
uintptr(hwnd),
uintptr(id),
uintptr(fsModifiers),
uintptr(vk),
0,
0)
return ret != 0
}

func RegisterRawInputDevices(pRawInputDevices *RAWINPUTDEVICE, uiNumDevices uint32, cbSize uint32) bool {
ret, _, _ := syscall.Syscall(registerRawInputDevices.Addr(), 3,
uintptr(unsafe.Pointer(pRawInputDevices)),
Expand Down