diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5572e69 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/go.mod b/go.mod index c765df8..b547544 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/user32.go b/user32.go index fd5eb4e..9274d62 100644 --- a/user32.go +++ b/user32.go @@ -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 @@ -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") @@ -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)),