|
|
@ -321,3 +321,37 @@ func SetClipboardViewer(hWndNewViewer HWND) (HWND, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return HWND(r), nil
|
|
|
|
return HWND(r), nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func CreateWindowEx(dwExStyle DWORD, lpClassName, lpWindowName string, dwStyle DWORD, x, y, nWidth, nHeight int, hWndParent HWND, hMenu HMENU, hInstance HINSTANCE, lpParam unsafe.Pointer) (HWND, error) {
|
|
|
|
|
|
|
|
user32, err := syscall.LoadLibrary("user32.dll")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return 0, errors.New("Can't Load User32 API")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer syscall.FreeLibrary(user32)
|
|
|
|
|
|
|
|
cwe, err := syscall.GetProcAddress(syscall.Handle(user32), "CreateWindowExW")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return 0, errors.New("Can't Load CreateWindowEx API")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
r, _, errno := syscall.Syscall12(cwe, 11, uintptr(dwExStyle), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpClassName))), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpWindowName))), uintptr(dwStyle), uintptr(x), uintptr(y), uintptr(nWidth), uintptr(nHeight), uintptr(hWndParent), uintptr(hMenu), uintptr(hInstance), uintptr(lpParam))
|
|
|
|
|
|
|
|
if r == 0 {
|
|
|
|
|
|
|
|
return 0, error(errno)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return HWND(r), nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func GetMessage(lpMsg *MSG, hWnd HWND, wMsgFilterMin, wMsgFilterMax DWORD) (DWORD, error) {
|
|
|
|
|
|
|
|
user32, err := syscall.LoadLibrary("user32.dll")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return 0, errors.New("Can't Load User32 API")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
defer syscall.FreeLibrary(user32)
|
|
|
|
|
|
|
|
gm, err := syscall.GetProcAddress(syscall.Handle(user32), "GetMessageW")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return 0, errors.New("Can't Load GetMessage API")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
r, _, errno := syscall.Syscall6(gm, 4, uintptr(unsafe.Pointer(lpMsg)), uintptr(hWnd), uintptr(wMsgFilterMin), uintptr(wMsgFilterMax), 0, 0)
|
|
|
|
|
|
|
|
if r == 0 {
|
|
|
|
|
|
|
|
return 0, error(errno)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return DWORD(r), nil
|
|
|
|
|
|
|
|
}
|
|
|
|