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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to create static text dynamically on dialogbox?

How to create static text dynamically on dialogbox?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 Posts 4 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.
  • J Offline
    J Offline
    jadhav123
    wrote on last edited by
    #1

    Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj

    H S T 3 Replies Last reply
    0
    • J jadhav123

      Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      DeclareCStatic myStatic; in class not in a function_**


      **_

      whitesky


      1 Reply Last reply
      0
      • J jadhav123

        Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj

        S Offline
        S Offline
        see me
        wrote on last edited by
        #3

        Its working wen i tried with the same code. But Declared this as a member of class. CStatic myStatic; Dream bigger... Do bigger...Expect smaller aji

        1 Reply Last reply
        0
        • J jadhav123

          Hi All, I want ot create static text on the dialog box. I wrote following code in OninitDialog function. CStatic myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this); But it doesn't work for me. Whats wrong.. can anybody help me regards, Aj

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          jadhav123 wrote:

          Static myStatic; myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(15,15,150,50), this);

          it is not created because, as soon as OnInitDialog function Exit, scope of MyStatic variable will end which inturn destory the object..  Now if you want to see Your Dynamically created Static Box you have to decalre CStatic variable as global or as classmember, so ity lifetime is that of program :)

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

          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