Changing text in a Form during runtime

Hey,

I've created a program that needs to display a repeatedly changing text.
Sadly, I have so far not been successful with that.
Ive tried using the SendMessage(HWND(IDC_Text1), UINT((LPCWSTR)L"testing"), WM_SETTEXT, 0); to update the text.
I believe my problem is that Im using a normal text box from the MS VS 2010 Toolbox.
I need to create a proper text function on the Window that the program can update when the SendMessage() or a similiar function is called.
I have used google, but I cant get a working solution.
Can anyone help me with this?
Thanks!
You can use SetDlgItemText function: SetDlgItemText(handle_of_window,IDC_Text1,L"text");

or if you want to use SendMessage function: SendMessage(GetDlgItem(handle_of_window,IDC_Text1),WM_SETTEXT,0,(LPARAM)"testing");

WM_SETTEXT:
http://msdn.microsoft.com/en-us/library/ms632644(VS.85).aspx
SetDlgItemText:
http://msdn.microsoft.com/en-us/library/ms645521(VS.85).aspx
Last edited on
Thanks a lot!! It works great. :)
Last edited on
Topic archived. No new replies allowed.