Possible to store user defined data with a window?
So I've got a call to CreateWindowEx and I set a value for it's lParam but I have no idea how to retrieve that info at a later date. The lParam is a pointer to a user defined class. Any thoughts on this?
The LPARAM parameter of the WM_CREATE message contains a CREATESTRUCT pointer which contains the lpCreateParams member which is your lParam.
Hope that helps
Thermo/Konfu
Hope that helps
Thermo/Konfu
Process the WM_CREATE message. Cast the lParam value to a CREATESTRUCT * and the lParam value passed to the CreateWindowEx function is the lpCreateParams value of the CREATESTRUCT.
Skizz
Skizz
Quote:Original post by Skizz
Process the WM_CREATE message. Cast the lParam value to a CREATESTRUCT * and the lParam value passed to the CreateWindowEx function is the lpCreateParams value of the CREATESTRUCT.
Skizz
So handling the WM_CREATE message is the only time I can get that info? I can't access it at an arbitrary point during run time?
Quote:Original post by rsegal
So handling the WM_CREATE message is the only time I can get that info? I can't access it at an arbitrary point during run time?
That is correct. If you need to store the data for arbitrary retrieval at a later time, grab the info in the lpCreateParms during the WM_CREATE processing, and then use SetWindowLongPtr() to associate it with the window. Then, at a later point, use GetWindowLongPtr() to retrieve the data.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement