Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing STATIC control caption

Changing STATIC control caption

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DerekSaw
    wrote on last edited by
    #1

    How to change the caption for a STATIC control under a dialog box with codes? I've try sending WM_SETTEXT to the STATIC's wndhandle (obtain from ::GetDlgItem)... but it does nothing.

    D N 2 Replies Last reply
    0
    • D DerekSaw

      How to change the caption for a STATIC control under a dialog box with codes? I've try sending WM_SETTEXT to the STATIC's wndhandle (obtain from ::GetDlgItem)... but it does nothing.

      D Offline
      D Offline
      DerekSaw
      wrote on last edited by
      #2

      Oh. Thanks anyway. I've tested that out. We need to SET it after ShowWindow... *sigh*... is it true?

      T 1 Reply Last reply
      0
      • D DerekSaw

        How to change the caption for a STATIC control under a dialog box with codes? I've try sending WM_SETTEXT to the STATIC's wndhandle (obtain from ::GetDlgItem)... but it does nothing.

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        You can associate a dialog class member with the static control. But you need to change the default control id of the static control for that. Nish


        Author of the romantic comedy Summer Love and Some more Cricket [New Win]

        D 1 Reply Last reply
        0
        • D DerekSaw

          Oh. Thanks anyway. I've tested that out. We need to SET it after ShowWindow... *sigh*... is it true?

          T Offline
          T Offline
          Tim Smith
          wrote on last edited by
          #4

          No, that isn't true. But you should use SetWindowText instead of WM_SETTEXT. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

          D 1 Reply Last reply
          0
          • T Tim Smith

            No, that isn't true. But you should use SetWindowText instead of WM_SETTEXT. Tim Smith I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?

            D Offline
            D Offline
            DerekSaw
            wrote on last edited by
            #5

            Yep.. I did that (both SetWindowText and WM_SETTEXT)... but no text is changed.... if I set it between Create and ShowWindow, nothings happen. But if I set it after ShowWindow, yes it works! And btw, I'm using the old MFC 4.21 (i.e. from VC++ 97)

            1 Reply Last reply
            0
            • N Nish Nishant

              You can associate a dialog class member with the static control. But you need to change the default control id of the static control for that. Nish


              Author of the romantic comedy Summer Love and Some more Cricket [New Win]

              D Offline
              D Offline
              DerekSaw
              wrote on last edited by
              #6

              I already change the default id to something else (e.g. IDC_SOMEDIALOG_LABEL)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups