When you have a reference to a method (e.g. function of object) the
address operator doesn't return the address of the function, but
instead to a TMethod record which contains two "pointers": to the
function and to an object which is the implementor of the
function/method (Self).
Regards,
Flávio
On 3/13/07, Vincent Snijders <[EMAIL PROTECTED]> wrote:
Felipe Monteiro de Carvalho schreef:
> Hello,
>
> It´s almost working. I am quite proud to have created a completely
> independent implementation of AllocateHWnd =)
>
> Ok, now my problem is that TMethod has 2 informations. A Code pointer,
> and a Data pointer, and I can´t seam to find enougth space on
> SetWindowLong for 2 extra informations.
>
> GWL_USERDATA seams to work perfectly. Next I tryed both GWL_ID and
> DWL_USER, but I always get nil when using GetWindowLong with them.
> Maybe I could transform my form into a Dialog to use DWL_USER. What is
> the definition of a dialog? How can I make a window that is a dialog?
> Just set dialog Window flag?
>
> Any other ideas about how to store 1 more pointer?
I would allocate a memory block from the heap, copy the LCLMethod into
it and use SetWindowsLong or SetProp (like the windowinfo) to associate
the allocated memory with the window.
Uncompiled code:
var
MyMethod: ^TLCLWndMethod;
begin
new(MyMethod);
MyMethod^ := ;
SetWindowLongPtr(Handle, GWL_USERDATA, ptrint(MyMethod));
end;
When you destroy the window get the MyMethod pointer and destroy it.
Vincent
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives