Hi all,
I am trying to use ‘SetTimer’ function from windows api. This is my declaration in python.
SetTimer = windll.user32.SetTimer
SetTimer.argtypes = [HWND, UINT_PTR, UINT, TIMERPROC]
SetTimer.restype = UINT_PTR
And this is TIMERPROC function declaration.
TIMERPROC = WINFUNCTYPE(UINT_PTR, HWND, UINT, UINT_PTR, DWORD)
This is the signature of SetTimer function in MSDN
UINT_PTR SetTimer(
[in, optional] HWND hWnd,
[in] UINT_PTR nIDEvent,
[in] UINT uElapse,
[in, optional] TIMERPROC lpTimerFunc
);
See, the 4th parameter is optional. I know that there is no concept of ‘optional’ in ctypes. So I used ‘None’ for 4th parameter. But python shows this error message.
ctypes.ArgumentError: argument 4: <class 'TypeError'>: expected WinFunctionType instance instead of NoneType
How to fix this ?