SetWindowText

This is a discussion on SetWindowText within the Windows Programming forums, part of the Platform Specific Boards category; Hi all. I'm trying to use SetWindowText to output text onto a read only edit box. I've gotten it to ...

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    SetWindowText

    Hi all. I'm trying to use SetWindowText to output text onto a read only edit box. I've gotten it to work except for it won't display (or change) it on the screen until the user clicks on the box. In a Win32 help file I have it says SetWindowText cause a WM_SETTEXT message to be sent. My main question is what code should I have under the WM_SETTEXT case?

    Code:
                 if (codition1 > codition2)
                    SetWindowText(hwndResult, TEXT("TEXT1"));
                 if ( codition2 > codition1)
                    SetWindowText(hwndResult, TEXT("TEXT2"));
                 if (codition1== codition2)
                    SetWindowText(hwndResult, TEXT("TEXT3"));
    Thanks

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post I don't know if this helps...

    You need an action calling for the "if" statements, and you need "if/else if" not just "if"
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    There is a lot more code then this envolved. And the way I have it setup doesn't require an else statement. I was just showing how I'm envoking the SetWindowText command.

  4. #4
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Cool Ohhhh, ok...

    Ok, sorry. What is the problem with it?
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    I'll use SetWindowText and it will put the text in the edit box but you can't see it until you click on the edit box.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Try adding an UpdateWindow() after the settext().
    Pass in the edits HWND.

    Sounds like the string is in the edit but needs to be repainted.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Ok I'll give that a try when I get back home. It would be UpdateWindow(hwndResult) right? Thanks

  8. #8
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Ok all I got it to work. I threw a InvalidateRect() at the end and it took care of the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetWindowText()
    By jay kay in forum Windows Programming
    Replies: 1
    Last Post: 03-14-2005, 01:40 PM
  2. SetWindowText(...) in richedit controls
    By jimmy_anttila in forum Windows Programming
    Replies: 8
    Last Post: 05-21-2004, 02:57 PM
  3. SetWindowText();
    By psychopath in forum Windows Programming
    Replies: 3
    Last Post: 04-04-2004, 03:56 AM
  4. SetWindowText()
    By COBOL2C++ in forum Windows Programming
    Replies: 4
    Last Post: 09-17-2003, 11:39 PM
  5. SetWindowText Error ;(
    By NickName-Here in forum Windows Programming
    Replies: 8
    Last Post: 07-19-2003, 07:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21