Windows and Subclassing - 'OverflowError': int too long to convert
Eryk Sun
eryksun at gmail.com
Wed Jul 29 10:26:22 EDT 2020
On 7/28/20, Eko palypse <ekopalypse at gmail.com> wrote:
>
> Now when I get this error the message I receive in this situation is always
> like this.
>
> hWnd=197364, msg=20, wParam=*18446744072652653190*, lParam=0
>
> Traceback (most recent call last):
> File "_ctypes/callbacks.c", line 237, in 'calling callback function'
> File "<string>", line 121, in new_scintilla2_proc
> ctypes.ArgumentError: argument 4: <class 'OverflowError'>: int too long to
> convert
Can you provide a more complete example of how you're calling
CallWindowProcW in new_scintilla2_proc? It seems like a function
pointer is being called that doesn't have argtypes defined. For
example:
>>> user32 = ctypes.WinDLL('user32', use_last_error=True)
>>> user32.CallWindowProcW(None, None, 0x14, 18446744072652653190, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ctypes.ArgumentError: argument 4: <class 'OverflowError'>: int too
long to convert
Perhaps in new_scintilla2_proc you're using a different instance of
ctypes.WinDLL, or you switched to using ctypes.windll.user32. I
recommend avoiding the global ctypes.LibraryLoader instances --
ctypes.cdll, ctypes.windll, and ctypes.oledll -- because using them
leads to conflicts with other libraries, but you do need to use a
single instance of ctypes.WinDLL for your user32 function prototypes,
imported from a common module.
More information about the Python-list
mailing list