diff --git a/user32.go b/user32.go index fc8e45f..20edfae 100644 --- a/user32.go +++ b/user32.go @@ -339,6 +339,20 @@ func CreateWindowEx(dwExStyle DWORD, lpClassName, lpWindowName string, dwStyle D return HWND(r), nil } +func DestoryWindow(hWnd HWND) (bool, error) { + user32, err := syscall.LoadLibrary("user32.dll") + if err != nil { + return false, errors.New("Can't Load User32 API") + } + defer syscall.FreeLibrary(user32) + dw, err := syscall.GetProcAddress(syscall.Handle(user32), "DestroyWindow") + if err != nil { + return false, errors.New("Can't Load DestroyWindow API") + } + r, _, _ := syscall.Syscall(dw, 1, uintptr(hWnd), 0, 0) + return r != 0, nil +} + func GetMessage(lpMsg *MSG, hWnd HWND, wMsgFilterMin, wMsgFilterMax DWORD) (DWORD, error) { user32, err := syscall.LoadLibrary("user32.dll") if err != nil {