I found a trick to cast pointers to a PtrUInt:
var
p: pointer;
adr: PtrUInt;
begin
adr := 0; // initialize variable to avoid compiler hint
p := @HotKey_MsgProc; // get a procedure pointer (or any other pointer or address)
move(p,adr,sizeof(adr)); // cast to PtrUint by brutal copy
// and now, use the pointer value where a LongInt is expected
SetWindowLong(wnd, GWL_WNDPROC, adr);
Again, it's not a complete program, just a sample code with the variable declarations.
It's working. But I find it really nasty. Isn't there a type-cast to load a pointer into a PtrUInt ? The latter isn't it designed for holding pointers ? But how do I get them into it ?
EDIT
I found the symetric method to cast an integer variable holding a pointer to a pointer variable:
var
p: pointer
begin
p := nil;
move(HotKey_oldmsgproc,p,sizeof(p));
Result := CallWindowProc(p, wnd, Msg, wParam, lParam);
All this avoids compiler hints ans warning, and it's working. But ugly. There should be an in-built way to accomplish these casts !