Im creating my own button like control. My question is when you create the window, does windows save the text you pass as the lpWindowName? Or am i going to have to allocate memory for it myself and copy the text to it?
Posted on 2002-07-06 20:47:02 by ChimpFace9000
I'm pretty sure you have to handle it yourself. WM_CREATE, WM_SETTEXT,
WM_GETTEXT :). At least that's how I have handled the stuff.
Posted on 2002-07-06 20:48:23 by f0dder
thanks
Posted on 2002-07-06 21:58:17 by ChimpFace9000
No, Windows will save it away in the window structure. You don't need to keep the text after you call CreateWindow or CreateWindowEx.
Posted on 2002-07-06 22:49:15 by Sephiroth3
To get it, use GetWindowText.

You have two choices: allocate a buffer at WM_CREATE, save a pointer to it in GWL_USERDATA, and ask GetWindowText to put the window name in the buffer. At every WM_PAINT you just need to refer to this buffer, but remember to dealloc the buffer at WM_DESTROY.

Or, allocate a LOCAL buffer at WM_PAINT, and at each WM_PAINT just use GetWindowText to put it into the LOCAL buffer. Slightly less fast maybe, but easier to do.
Posted on 2002-07-07 20:45:25 by AmkG