From 406a6d4d0d5b0622b06b6221c9d453fbb3ca0c1b Mon Sep 17 00:00:00 2001 From: True Syanic YT <94116695+fspofficial@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:48:58 +0530 Subject: [PATCH] Fixed error- WNDPROC return value cannot be converted to LRESULT TypeError: WPARAM is simple, so must be an int object (got NoneType) The error "WNDPROC return value cannot be converted to LRESULT TypeError: WPARAM is simple, so must be an int object (got NoneType)" is occurring because the `on_destroy` method is not returning any value explicitly, and as a result, it returns `None` by default. However, in this case, `on_destroy` should return an integer value (`LRESULT`). To fix the issue, you can add `return 0` at the end of the `on_destroy` method to explicitly return 0. Here's the modified `on_destroy` method: ```python def on_destroy(self, hwnd, msg, wparam, lparam): """Clean after notification ended. :hwnd: :msg: :wparam: :lparam: """ nid = (self.hwnd, 0) Shell_NotifyIcon(NIM_DELETE, nid) PostQuitMessage(0) return 0 # Explicitly return 0 to fix the error ``` With this change, the `on_destroy` method will now return an integer value (`LRESULT`) as expected, and the error should be resolved. --- win10toast_click/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win10toast_click/__init__.py b/win10toast_click/__init__.py index f988fc4..2946317 100644 --- a/win10toast_click/__init__.py +++ b/win10toast_click/__init__.py @@ -188,6 +188,7 @@ def wnd_proc(self, hwnd, msg, wparam, lparam, **kwargs): def on_destroy(self, hwnd, msg, wparam, lparam): """Clean after notification ended. + :hwnd: :msg: :wparam: @@ -197,6 +198,6 @@ def on_destroy(self, hwnd, msg, wparam, lparam): Shell_NotifyIcon(NIM_DELETE, nid) PostQuitMessage(0) - return None + return 0 # Explicitly return 0 to fix the error - # !FIX: TypeError: 'tuple' object is not callable \ No newline at end of file + # !FIX: TypeError: 'tuple' object is not callable