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. how to change the title bar of mainframe of proj?

how to change the title bar of mainframe of proj?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
8 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
    ns
    wrote on last edited by
    #1

    MFC MDI project: I didnt name my project with the final name in mind, and now i cant seem to change the title bar of the project. In project settings i was able to give a suitable new name to the exe but the title bar still has the name of the project in it, even though I rebuilt the prj. Please tell me theres some trivial way of changing the name in the title bar.... I looked into the rc file with notepad but dont see anything I can change there, (I dont really know what I'm looking for.) Anyways is is safe to edit the rc file? Thanks, ns I tried SetWindowText in mainfrms OnCreate and also in OnInitialUpdate of the view...didnt work. Also did cs.lpSzName in PreCreateWindow....thats no good too.

    B 1 Reply Last reply
    0
    • N ns

      MFC MDI project: I didnt name my project with the final name in mind, and now i cant seem to change the title bar of the project. In project settings i was able to give a suitable new name to the exe but the title bar still has the name of the project in it, even though I rebuilt the prj. Please tell me theres some trivial way of changing the name in the title bar.... I looked into the rc file with notepad but dont see anything I can change there, (I dont really know what I'm looking for.) Anyways is is safe to edit the rc file? Thanks, ns I tried SetWindowText in mainfrms OnCreate and also in OnInitialUpdate of the view...didnt work. Also did cs.lpSzName in PreCreateWindow....thats no good too.

      B Offline
      B Offline
      bneacetp
      wrote on last edited by
      #2

      In the resource view, open the String Table and edit the IDR_MAINFRAME caption to what you want to appear in the titlebar of your project. You might also want to change the AFX_IDS_APP_TITLE string caption to something different as well since calling AfxMessageBox(...) will display the AFX_IDS_APP_TITLE string caption in its titlebar. That should do it. :-D Happy Programming! WWW::CodeProject::BNEACETP

      N 1 Reply Last reply
      0
      • B bneacetp

        In the resource view, open the String Table and edit the IDR_MAINFRAME caption to what you want to appear in the titlebar of your project. You might also want to change the AFX_IDS_APP_TITLE string caption to something different as well since calling AfxMessageBox(...) will display the AFX_IDS_APP_TITLE string caption in its titlebar. That should do it. :-D Happy Programming! WWW::CodeProject::BNEACETP

        N Offline
        N Offline
        nss
        wrote on last edited by
        #3

        Wow! Cant wait to try it tomorrow. Thanks so much!!!! ns

        B 1 Reply Last reply
        0
        • N nss

          Wow! Cant wait to try it tomorrow. Thanks so much!!!! ns

          B Offline
          B Offline
          bneacetp
          wrote on last edited by
          #4

          nss wrote: Thanks so much!!!! No problem. Glad to help. :-D Happy Programming! WWW::CodeProject::BNEACETP

          N 1 Reply Last reply
          0
          • B bneacetp

            nss wrote: Thanks so much!!!! No problem. Glad to help. :-D Happy Programming! WWW::CodeProject::BNEACETP

            N Offline
            N Offline
            ns
            wrote on last edited by
            #5

            Well, that works great, but now, in the title I get: MyGoodProjectName - OldPrjName1....sort of like thats the name of the document or view or something. I tried changing the IDR_STRAINTYPE string but thats not it apparently. So the old prj name is still sneaking in.... Ideas? Thanks, ns

            B 1 Reply Last reply
            0
            • N ns

              Well, that works great, but now, in the title I get: MyGoodProjectName - OldPrjName1....sort of like thats the name of the document or view or something. I tried changing the IDR_STRAINTYPE string but thats not it apparently. So the old prj name is still sneaking in.... Ideas? Thanks, ns

              B Offline
              B Offline
              bneacetp
              wrote on last edited by
              #6

              By looking to IDR_STRAINTYPE, you are on the right track. That is the string that you need to change. I built a quick app named "newMFC" and I have its "TYPE" string resource below: \nnewMFC\nnewMFC\n123 Files (*.123)\n.123\nnewMFC.Document\nnewMFC.Document Change the first "line" or section of this string to what you want the document to be called by default. For instance, if I wanted it to show "New Document" I would change the above line to: \nNew Document\nnewMFC\n123 Files (*.123)\n.123\nnewMFC.Document\nnewMFC.Document DO NOT remove the new line characters (\n) in the process. That should do it. :-D For future reference, below is what each section is for, corresponding to the MFC App Wizard: 1) \nnewMFC - Document Type Name 2) \nnewMFC - File new short name 3) \n123 Files (*.123) - The filter name 4) \n.123 - The actual file type filter 5) \nnewMFC.Document - The file type ID 6) \nnewMFC.Document - The File type Long name I hope that fixes things for you. If I understand your problem right, it should. Good luck with the rest of your project. :) Happy Programming! WWW::CodeProject::BNEACETP

              N 1 Reply Last reply
              0
              • B bneacetp

                By looking to IDR_STRAINTYPE, you are on the right track. That is the string that you need to change. I built a quick app named "newMFC" and I have its "TYPE" string resource below: \nnewMFC\nnewMFC\n123 Files (*.123)\n.123\nnewMFC.Document\nnewMFC.Document Change the first "line" or section of this string to what you want the document to be called by default. For instance, if I wanted it to show "New Document" I would change the above line to: \nNew Document\nnewMFC\n123 Files (*.123)\n.123\nnewMFC.Document\nnewMFC.Document DO NOT remove the new line characters (\n) in the process. That should do it. :-D For future reference, below is what each section is for, corresponding to the MFC App Wizard: 1) \nnewMFC - Document Type Name 2) \nnewMFC - File new short name 3) \n123 Files (*.123) - The filter name 4) \n.123 - The actual file type filter 5) \nnewMFC.Document - The file type ID 6) \nnewMFC.Document - The File type Long name I hope that fixes things for you. If I understand your problem right, it should. Good luck with the rest of your project. :) Happy Programming! WWW::CodeProject::BNEACETP

                N Offline
                N Offline
                ns
                wrote on last edited by
                #7

                By golly! You have done it again!!! I had eralier tried exactly what you say to do, but I hadnt closed the editbox (after I changed the entry so the change didnt take effect) before building the proj again which is why I saw no difference. But this time I edited the resource , saved it, closed the editbox and then built and ran....viola! I appreciate your careful explanation of the various sections. It still likes to tack on a "1" at the end of the title as in : MyProject - CorrectNAme1 --- which is quite acceptable. SO, many many thanks again! ns

                B 1 Reply Last reply
                0
                • N ns

                  By golly! You have done it again!!! I had eralier tried exactly what you say to do, but I hadnt closed the editbox (after I changed the entry so the change didnt take effect) before building the proj again which is why I saw no difference. But this time I edited the resource , saved it, closed the editbox and then built and ran....viola! I appreciate your careful explanation of the various sections. It still likes to tack on a "1" at the end of the title as in : MyProject - CorrectNAme1 --- which is quite acceptable. SO, many many thanks again! ns

                  B Offline
                  B Offline
                  bneacetp
                  wrote on last edited by
                  #8

                  One more thing since you mentioned it. It may or may not matter much, but I think it looks a little nicer if there is a space between the new document name and the number. This "New Document 1" instead of this "New Document1". If you would like the first effect, just insert a space after the name and MFC will tack on the number after the space which, just according to my preference, looks a bit nicer. \nNew Document \nnewMFC... PROMPTS "AppName - New Document 1" instead of \nNew Document\nnewMFC... PROMPTS "AppName - New Document1" Just thought you might be interested. Once again, good luck with your project! :) ns wrote: SO, many many thanks again! Your welcome! :-D:-D:-D Happy Programming! WWW::CodeProject::BNEACETP

                  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