Im learning to create my own controls, and i heres my question...

When i use the CreateWindowEx function to create my control, how do i get the text thats sent in the WindowName parameter? I need to get it so i can display it on a paint message. There has to be a way because buttons use it, and im trying to make my control act just like a windows control.
Posted on 2002-03-14 14:26:36 by ChimpFace9000
GetWindowText should do the trick.
Posted on 2002-03-14 18:00:45 by sluggy
Yes, but i shouldnt have to use it though. Shouldnt windows give it to me in a message for my wnd proc.
Posted on 2002-03-14 19:03:16 by ChimpFace9000
Shouldnt windows give it to me in a message for my wnd proc.
Not that i know of. The title bar (where that text resides) is separate to the rest of the window, and is treated differently.

But having said that, there are thousands of windows messages, and i but humbly know only a few :) Check through the list on MSDN online, you may well find something.
Posted on 2002-03-14 20:11:27 by sluggy
WM_CREATE gives you a CREATESTRUCT (pointer in lParam) that holds the CreateWindowEx arguments.
Posted on 2002-03-15 14:05:51 by tenkey
Controls normally support changing the title though, so you ought
to send WM_GETTEXT or use GetWindowText in your WM_PAINT
handler... or trap WM_SETTEXT and store it in a buffer.
Posted on 2002-03-15 19:28:28 by f0dder
ChimpFace9000,

Have a look at a custom control I posted in the MASM32 forum, it does most of the things that you are after. The window you create has the available memory to store the text for the titlebar or similar but if you are writing a control, you will need to get that text from the window and display it with an API like DrawText or textOut at the location in the window that you require.

Its no big deal to do, just hack API coding.

Regards,

hutch@movsd.com
Posted on 2002-03-15 19:41:12 by hutch--