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. Change Title text in my MainFrame

Change Title text in my MainFrame

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • U Offline
    U Offline
    User 1354
    wrote on last edited by
    #1

    I want to change the Titletext of my MainFrame at startup. Now I use SetWindowText(...) but this only takes effect when I click on my menu (I dont know why). But I want the text written at startup. Does anyone know what I am doing wrong? Thank you...

    L M S 3 Replies Last reply
    0
    • U User 1354

      I want to change the Titletext of my MainFrame at startup. Now I use SetWindowText(...) but this only takes effect when I click on my menu (I dont know why). But I want the text written at startup. Does anyone know what I am doing wrong? Thank you...

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hope This will Help void CFAdhlyView::OnDraw(CDC* pDC) { CFAdhlyDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDoc->SetTitle (_T("Set The title here")); }

      1 Reply Last reply
      0
      • U User 1354

        I want to change the Titletext of my MainFrame at startup. Now I use SetWindowText(...) but this only takes effect when I click on my menu (I dont know why). But I want the text written at startup. Does anyone know what I am doing wrong? Thank you...

        M Offline
        M Offline
        Mike Dunn
        wrote on last edited by
        #3

        Override CFrameWnd::OnUpdateFrameTitle(). This is a virtual function, but undocumented, so you'll need to add the prototype yourself. When this function is called, call SetText() to set the frame window caption. The default implementation is in winfrm.cpp, line 1746. You can check that out to get an idea of what you can do with the function.

        1 Reply Last reply
        0
        • U User 1354

          I want to change the Titletext of my MainFrame at startup. Now I use SetWindowText(...) but this only takes effect when I click on my menu (I dont know why). But I want the text written at startup. Does anyone know what I am doing wrong? Thank you...

          S Offline
          S Offline
          Sam Hobbs
          wrote on last edited by
          #4

          MFC uses two parts for a window title composed of a "frame window title" followed by a "document name", but the frame window title is used only if the FWS_ADDTOTITLE Frame-Window Style is set. See: http://support.microsoft.com/support/kb/articles/q129/0/95.asp for the Microsoft Knowledge Base article "INFO: Format of the Document Template String" that describes how to modify the windowTitle and docName strings; that might be relevant for you. The document name can be changed using CDocument::SetTitle.

          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