In FPC, the definition of WPARAM is "WPARAM = LONG_PTR", unfortunately, this is incorrect. WPARAM is a UINT_PTR.
In most cases, it doesn't make a difference because the type size is the same but, it causes a problem, specifically type mismatches, when a Window proc is defined correctly and a pointer to that correctly defined proc is specified in some structure that uses FPC's WNDPROC definition. The mismatch occurs because in the FPC definition, the WPARAM parameter is a LONG_PTR whereas the correct window proc has it as a UINT_PTR.
For instance, this occurs when specifying the Window procedure in the TWndClassEx which wants a pointer to the window proc in lpfnWndProc.
Unfortunately, it may not be easy to correct this because it may potentially affect quite a few programs but, I believe there should be awareness of the problem.
HTH.