Changing text in Static control

I have some static text on a window, and want to change it after a progressbar gets to a certain point. I've got the progressbar set up and everything, but what do I use to change the text of the static control? Using a string doesn't work, and SendMessage gives many errors. Any ideas?
Assuming you're using char strings, SetWindowTextA:

1
2
3
HWND wnd = handle_to_your_static_text_control;

SetWindowTextA( wnd, "The text you want to set." );
Why SendMessage 'does not work' ?
You need to send WM_SETTEXT message.
@Disch

Okay, that works, however when I tell the program to change the text if the variable 'i' is equal to 1 (it starts at zero, then the i++ command is sent in the WM_TIMER case), but it doesn't change. How to I refresh the window to show the text? Or is that even my problem?
That is not likely your problem. SetWindowText will automatically refresh the window whose text it's updating.

Are you sure your WM_TIMER code is even running? Did you try putting a breakpoint on it and making sure it's actually executing?
All I needed was brackets around the WM_TIMER case code.

Now how do I pause the progressbar? Sleep(); ?
Topic archived. No new replies allowed.