Pointers, casting, SetGetWindowLong problem...
Chris Warwick
sp at m.me.not
Fri Mar 9 17:10:35 PST 2007
"Derek Parnell" <derek at psych.ward> wrote in message
news:1f2c01vt6zeaq$.ac8d0velaphe$.dlg at 40tude.net...
> On Fri, 9 Mar 2007 23:16:34 -0000, Chris Warwick wrote:
>
>
>> TWindow window = cast(TWindow) cast(void*) GetWindowLongA(handle,
>> 0);
>> if (window == null) return DefWindowProcA(handle, msg, wparam,
>> lparam);
>>
>> but i keep getting an access violation on the if (window == null),
>>
>> if i change it to
>>
>> if (window == null) beep(400,50)
>>
>> i still get it, the AV that is, but if i just skip the check and call the
>> DefWindoProcA it works fine.
>
> Use this instead ...
>
> if (window is null) ...
>
> Because ...
>
> if (window == null)
>
> is identical to
>
> if (window.opEquals(null))
>
> which will fail if 'window' is null because it needs to use it to
> reference
> the opEquals method.
So opEquals must be inherited from Object cause I havnt implememented it in
my class. So what exactly does this inherited opEquals do? How can an
inherited opEquals have any sensible result in descendant classes unless
overriden by those subclasses?
cheers,
cw
More information about the Digitalmars-d-learn
mailing list