SetWindowLongPtr with DialogBoxParam?
Posted
by
templatetypedef
on Stack Overflow
See other posts from Stack Overflow
or by templatetypedef
Published on 2011-01-06T06:47:15Z
Indexed on
2011/01/06
6:53 UTC
Read the original article
Hit count: 158
winapi
Hey all-
A while back I was writing a C++ program with the Win32 API that would display a dialog box and then listen to the messages it generated. At one point, I was interested in associating a piece of data with the dialog window. Were I manually creating the window and attaching a window proc, I'd just use SetWindowLongPtr
to set the GWLP_USERDATA
field to a pointer to the data to associate. However, in this case I was creating and displaying the window with DialogBoxParam
, and it wasn't clear whether this function was associating that data with its own internal state. Since the MSDN didn't have a description of what would happen in this case, I ended up using some other approach to solve the problem.
My question is this - is it safe to use SetWindowLongPtr
to overwrite the GWLP_USERDATA
value in a window created by DialogBoxParam
?
Thanks!
© Stack Overflow or respective owner