@d2010
I see your code is using SetWindowLong and SetWindowLongPtr protected by an $ifdef. You might be interested in knowing that the FPC API definitions for Windows declare SetWindowLongPtr for 32bit, mapping it to SetWindowLong, which means, you can simply code a call to SetWindowLongPtr without any $ifdef. IOW, SetWindowLongPtr works in both 32bit and 64bit (with FPC.)