Jump to content
  • Advertisement
Sign in to follow this  
rsegal

Possible to store user defined data with a window?

This topic is 5410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!