diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bf47b4..b7704f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.1.2 + +- `WindowBase`: + - `destroy`: returns `bool` and warns failed calls. + ## 1.1.1 - `WindowClassColors`: diff --git a/lib/src/win32_dialog.dart b/lib/src/win32_dialog.dart index 567626a..e231ada 100644 --- a/lib/src/win32_dialog.dart +++ b/lib/src/win32_dialog.dart @@ -309,9 +309,7 @@ class Dialog extends WindowBase { final timeout = this.timeout; if (timeout == null) return; - _timeoutTimer = Timer(timeout, () { - _notifyTimeout(); - }); + _timeoutTimer = Timer(timeout, _notifyTimeout); } bool _timeoutTriggered = false; diff --git a/lib/src/win32_gui_base.dart b/lib/src/win32_gui_base.dart index 4405e83..421653c 100644 --- a/lib/src/win32_gui_base.dart +++ b/lib/src/win32_gui_base.dart @@ -850,10 +850,19 @@ abstract class WindowBase> { /// Destroys this [Window]. /// - Calls Win32 [DestroyWindow]. - void destroy() { + bool destroy() { final hwnd = this.hwnd; - DestroyWindow(hwnd); + var r = DestroyWindow(hwnd); + if (r == 0) { + final errorCode = GetLastError(); + _logWindow.warning( + "Error closing `Window`> errorCode: $errorCode > $hwnd -> $this"); + + return false; + } + + return true; } /// Shows a message dialog. diff --git a/pubspec.yaml b/pubspec.yaml index 6f2ecfe..08bd4ed 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: win32_gui description: Win32 API GUI in Object-Oriented style with some helpers. Uses package `win32` and `dart:ffi`. -version: 1.1.1 +version: 1.1.2 repository: https://github.com/gmpassos/win32_gui screenshots: