Forum > LCL

[fixed]WM_WindowPosChanged gives null pointer to WindowPos record randomly


as stated.

 The WndpowPos record in the Message of TLMWindowPosChanged gives a nil pointer in the message at times.

I don't understand this because there isn't anything else in the record to use so what's the sense of sending a WM_WindowPosChanged message with a nil WindowPos record ?

 I tested this in Trunk and older lazes and I have also referenced the net and didn't find any documents where this is so?

 To test, just put a message handler for the LM_WindowPOSChanged and in the receiving method test the Message.WindowPos for a Nil pointer.

 This appears the be random from what I can see.

I found the reason but I still can't give an answer to why?

in the Procedure  TWinControl.SendMoveSizeMessages(….)

 They do a
      Perform(LM_WindowposChanged, 0, 0);

 as you can see, there is no pointer value in the Lparam parameter. ?
   This whole procedure does nothing but simulate a LM_MOVE and LM_SIZE instead of using the handlers from the OS.

 Although this is fine, why the need to send a fake blank message that can cause issues?

  What this means now is that code needs to test for a NIL windowPos record before attempting to reference it, more lard.

  From what I can see, the actual information is sent in a valid message and then this fake one is sent afterwards only if the values of either size or position changes, more lard.

 So in turn, you get twice the message traffic for the same message except maybe if a Z order did a change, lots more lard.

 Does this really make sense ?


  I filed a Bug report on this.
  we need all the speed and smoothness we can get with the GUI..
  Plus I also deal with custom messages passing through the class and don't need extra bloat..  %)

   I would be interested if anyone here is willing to rebuild their file with that line commented out using Linux which handles these things a little differently. Or even a MAC.

Fixed in Truck thanks to Michl


[0] Message Index

Go to full version