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. Setting the Title in an SDI Application

Setting the Title in an SDI Application

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 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.
  • N Offline
    N Offline
    nde_plume
    wrote on last edited by
    #1

    I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.

    S A 2 Replies Last reply
    0
    • N nde_plume

      I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.

      S Offline
      S Offline
      superhandwolf
      wrote on last edited by
      #2

      Add cs.style = WS_OVERLAPPEDWINDOW;" to function CMainFrame::PreCreateWindow, and add SetWindowText("mytitle"); to function CMainFrame::OnCreate. Then the title is changed to "mytitle". BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPEDWINDOW; return TRUE; } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { //... SetWindowText("mytitle"); return 0; }

      1 Reply Last reply
      0
      • N nde_plume

        I want to set the title in the Main frame window in an SDI app, but I can't seem to find the right function. I have tried setting the title in the document class, but instead of getting "Title" I get "Title -- Application Name" I have also tried CFrameWnd.SetTitle, and CFrameWnd.SetWindowText, but none of them seem to work. Any help would be much appreciated.

        A Offline
        A Offline
        Ashok Dhamija
        wrote on last edited by
        #3

        Do simply like this: In the InitInstance() function in your Application class, just before the line m_pMainWnd->ShowWindow(SW_SHOW), add the following line of code:

        m_pMainWnd->SetWindowText("My Application Title");

        Regards, Ashok Dhamija _____________________________ Padam Technologies

        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