Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows Dev
Hey folks!
 
I have a script similar to this:
 
 
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 11-Sep-11 13:27pm
Comments
SAKryukov at 11-Sep-11 23:25pm
   
Script? Similar to this? Ever head that C++ is compiling language, not interpreted?
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It sounds like you are looking for the SetWindowText Function[^]
 
SetWindowText(texthwnd,_T("Hello World"));
 
Best Wishes,
-David Delaune
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Thanks but i actually found a solution but your's was much better! Thanks alot!
 
My solution was SetDlgItemText Function
 
SetDlgItemText(texthwnd, 0, "Some teext!!!");
 
Well still thanks alot!!
  Permalink  

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

  Print Answers RSS
0 Maciej Los 450
1 OriginalGriff 403
2 CPallini 189
3 Sergey Alexandrovich Kryukov 189
4 CHill60 180
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 4,958
2 Maciej Los 3,269
3 Peter Leow 3,129
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 11 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100