WPARAM definition lazarus / 13-General ---------------------------------------------------------------------- 440bx · 2025-05-18 04:43 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. ---------------------------------------------------------------------- Thaddy · 2025-05-18 13:24 This dates back from your favorite D2 era. There are a few people aware of it. ---------------------------------------------------------------------- marcov · 2025-05-18 13:33 Yes, Delphi translated a lot to signed types in the early days because a proper 32-bit unsigned only appeared later (D4?). Backwards compatibility, and it doesn't hurt unless people start to define their own "correct" structures. However, I know Delphi adjusted a few since (probably because of BCB?), but kept the one in interfaces signed IIRC. Try changing it and recompile Lazarus (bigide or bigger) to see if it creates a lot of problems. ---------------------------------------------------------------------- Thaddy · 2025-05-18 14:16 IIRC it is the diference between D4 and D5 where the compiler hardly changed and the D5 rtl was compilable with D4. I was rather taken aback at the time. Anyway, D5 and D7 were stable. Up until and including 2009 I tested them. (Also D1, which was a very rare privilage)