amazing function behavior

Zarathustra adam.chrapkowski at
Tue Oct 20 10:07:48 PDT 2009

Phil Deets Wrote:

> I don't know what the problem is, but I would try checking to see if the  
> pointer at window construction and the this pointer before calling  
> onMouseDown are the same. Maybe there is a problem with using the result  
> of getWindowLong as a pointer. For example, one value could be 32-bits and  
> the pointer could be 64-bits. I didn't run the code to test anything, I'm  
> just throwing out some ideas which may be way off.
> -- 

Ok I will try to explain:
In my opinion my code should works. I would like to refer to two places in the code.
1. inside window module:
  user32.messageBox(null, cast(wstr)"LBUTTONDOWN", cast(wstr)"msg", 0x00);
2: inside test module, version 1:
   Window wnd1 = new Window();
   inside test module, version 2:
   Window wnd1 = new Window();
   Window wnd2 = new Window();

Both versions should work identically. When the mouse button is clicked inside the window, I expect two messageBoxes: The first one with message "LBUTTONDOWN", and the second "Window".

But it is done only with the first version of test module (without wnd2 = new Window()).
In the second case (with wnd2 = new Window()) I see message "LBUTTONDOWN" and Access Violation with DMD 1.050 or just nothing! with DMD 2.035 (therefore 'amazing' in the topic).
I apologize for my horrible English, but I hope I explained that enough clearly.

More information about the Digitalmars-d-learn mailing list