Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(IMPORTANT) Fix __init__.py Error "WNDPROC return value cannot be converted to LRESULT TypeError: WPARAM is simple, so must be an int object (got NoneType)" #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fspofficial
Copy link

@fspofficial fspofficial commented Aug 2, 2023

ERROR: WNDPROC return value cannot be converted to LRESULT TypeError: WPARAM is simple, so must be an int object (got NoneType)

FIX: 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:

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.

Fixed-

WNDPROC return value cannot be converted to LRESULT
TypeError: WPARAM is simple, so must be an int object (got NoneType)
@fspofficial fspofficial changed the title Fix __init__.py (IMPORTANT) Fix __init__.py Error "WNDPROC return value cannot be converted to LRESULT TypeError: WPARAM is simple, so must be an int object (got NoneType)" Aug 2, 2023
@lkacz
Copy link

lkacz commented Sep 9, 2024

Changing from none to 0 solves the problem but it seems to make it problematic to genarate the distribution .exe file which uses the modified library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants