GetWindowLongPtr fails if called when handling WM_CREATE

Posted by Semen Semenych on Stack Overflow See other posts from Stack Overflow or by Semen Semenych
Published on 2010-06-15T05:30:45Z Indexed on 2010/06/15 5:32 UTC
Read the original article Hit count: 190

Filed under:

Calling the GetWindowLongPtr function for a dialog box with the DWL_USER parameter fails when done from the WM_CREATE handler. It gives no error (checked that, the return value is always zero), which, according to the MSDN documentation, occurs only if SetWindowLongPtr has not been called previously. However, I call it after registering the window class, and properly call the SetWindowPos after that. Finally, calling GetWindowLongPtr in any other event handler, that is, later than WM_CREATE, works fine. Is there something I'm missing in the initialization sequence, or maybe the messages are sent in some not so obvious order?

© Stack Overflow or respective owner

Related posts about winapi