diff --git a/user32.go b/user32.go index 3207c068..e388cbec 100644 --- a/user32.go +++ b/user32.go @@ -1648,6 +1648,7 @@ var ( updateWindow uintptr windowFromDC uintptr windowFromPoint uintptr + setLayeredWindowAttributes uintptr ) func init() { @@ -1779,6 +1780,7 @@ func init() { updateWindow = MustGetProcAddress(libuser32, "UpdateWindow") windowFromDC = MustGetProcAddress(libuser32, "WindowFromDC") windowFromPoint = MustGetProcAddress(libuser32, "WindowFromPoint") + setLayeredWindowAttributes = MustGetProcAddress(libuser32, "SetLayeredWindowAttributes") } func AddClipboardFormatListener(hwnd HWND) bool { @@ -2899,3 +2901,15 @@ func WindowFromPoint(Point POINT) HWND { return HWND(ret) } + +func SetLayeredWindowAttributes(hwnd HWND, crKey COLORREF, bAlpha byte, dwFlags uint32) bool { + ret, _, _ := syscall.Syscall6(setLayeredWindowAttributes, 4, + uintptr(hwnd), + uintptr(crKey), + uintptr(bAlpha), + uintptr(dwFlags), + 0, + 0) + + return ret != 0 +}