CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2004
    Location
    Florida
    Posts
    15

    Changing Static Text at Runtime

    In my program i have some info stored in a char... how can i have this show in my static text box?

    thanks for your time
    "Whoao, Amber is the Color of your Energy"

  2. #2
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Changing Static Text at Runtime

    Post a 'WM_SETTEXT' message to the static control....

  3. #3
    Join Date
    May 2004
    Location
    Simpheropol, Ukraine
    Posts
    73

    Re: Changing Static Text at Runtime

    You can also use SetDlgItemText() if your control is on the dialog box .

  4. #4
    Join Date
    Dec 2002
    Location
    Candia, NH
    Posts
    374

    Re: Changing Static Text at Runtime

    Or you can use SetWindowText() which sends the message. Won't work in a dialog box or standard window as it will change the title box instead. But it works nice for buttons and static windows.

  5. #5
    Join Date
    Nov 2004
    Posts
    11

    Re: Changing Static Text at Runtime

    Remember to put these call in the WM_PAINT message in your winproc...

    -face

  6. #6
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: Changing Static Text at Runtime

    Quote Originally Posted by ecaf
    Remember to put these call in the WM_PAINT message in your winproc...

    -face
    I think your thinking of DrawText or TextOut. SetWindowText, SetDlgItemText or posting a WM_SETTEXT message should NOT be done in a WM_PAINT handler.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured