My text

How would I change the text of this whenever I want?

CreateWindow(TEXT("STATIC"), TEXT(""), WS_VISIBLE | WS_CHILD,
40,80,400,25, hwnd, (HMENU)nugget, NULL, NULL);
That returns the child control's Windows, an HWND. To control that window, you'll need to send it messages either directly with Send/Post Message or with GDI calls that send the messages for you.

In the case of setting the text, you send WM_SETTEXT or call SetWindowText (which sends the message for you), using that handle.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546%28v=vs.85%29.aspx
Last edited on
Why is it that when you use this:


1
2
3

 SetDlgItemText(hwnd,0,"You picked Console Text Mode, now press play.");



It only gets the very first static window you made and changes it's txt?
A parent window knows if it has children. And it can get to those children. Those DlgItem functions taket he parent window and an index to the child. But it's just another way of referencing the child window handle.

If you're indexing to the wrong child, make sure you are passing in the correct index where you're currently passing zero.
For some reason I can only use it ounce, would menus count as children? Also could you give some example code with both ways you explained I learn better visually.
If you use Spy, you can see all windows and their children.
Topic archived. No new replies allowed.