Click here to Skip to main content
15,886,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey folks!

I have a script similar to this:

C++
void newThread(void* none){
    
    buff = "New changed text!!"
    Some script that changes texthwnd to buff;
    texthwnd.label = buff;                   //<---- This is what i want!
}


int winmain(blah,blah,,){
    Making window structure...
    
    still making window structure...

    hwnd = CreateWindowEx(blah, classname, windowname, blah);
    ShowWindow(hwnd, something);

    _beginthread(newThread, 0, 0);            //<--- IMPORTANT!

    while(1){
        some important while loop for messages;
    }
}

LRESULT CALLBACK WindowProcedure (blah,blah,blah){
    switch (message){
	case WM_CREATE:
	    texthwnd = CreateWindowEx(0, "STATIC", //<---- Creating the texthwnd.
            "Random Text",
            WS_CHILD | WS_VISIBLE | SS_SIMPLE,
            10, 10, 100, 100, hwnd, 0, 0, 0);
	    break;
		
		
        case WM_DESTROY:
            PostQuitMessage (0);
            break;
        default:
            return DefWindowProc (blah,);
    }

    return 0;
}


The thing I want is to change the text of the "texthwnd"?

How!?!?!?

I've been "googling" alot!

Im new to GUI programming and this is one of my first projects with GUI.

This is the first time i send a question anywhere on the internet so let me know if there's something i've missed!

Thanks!
Posted
Comments
Sergey Alexandrovich Kryukov 11-Sep-11 23:25pm    
Script? Similar to this? Ever head that C++ is compiling language, not interpreted?
--SA

It sounds like you are looking for the SetWindowText Function[^]

SetWindowText(texthwnd,_T("Hello World"));


Best Wishes,
-David Delaune
 
Share this answer
 
Thanks but i actually found a solution but your's was much better! Thanks alot!

My solution was SetDlgItemText Function

C++
SetDlgItemText(texthwnd, 0, "Some teext!!!");


Well still thanks alot!!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900