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 MFC icon

How to change the MFC icon

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
7 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.
  • G Offline
    G Offline
    gmlnd
    wrote on last edited by
    #1

    I have to change the standard MFC icon located in the top left portion of the main window to another icon.

    D H 2 Replies Last reply
    0
    • G gmlnd

      I have to change the standard MFC icon located in the top left portion of the main window to another icon.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Simply provide a new .ICO file in the res folder.

      G 1 Reply Last reply
      0
      • D David Crow

        Simply provide a new .ICO file in the res folder.

        G Offline
        G Offline
        gmlnd
        wrote on last edited by
        #3

        I have a file which is a type Icon, I have placed that in the res folder. Does it have to be .ICO? Once I place the file in the res folder, how do I actually import it in my program so it replaces the IDR_MAINFRAME image of MFC?

        D 1 Reply Last reply
        0
        • G gmlnd

          I have a file which is a type Icon, I have placed that in the res folder. Does it have to be .ICO? Once I place the file in the res folder, how do I actually import it in my program so it replaces the IDR_MAINFRAME image of MFC?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Note the name of the current IDR_MAINFRAME icon (e.g., myproject.ico). Delete that file. Rename your .ICO file to the name of the old (MFC) file. Recompile.

          1 Reply Last reply
          0
          • G gmlnd

            I have to change the standard MFC icon located in the top left portion of the main window to another icon.

            H Offline
            H Offline
            Hari Krishnan Noida
            wrote on last edited by
            #5

            Hi, Here is the way to change the icon programmatically, CSomeApp::InitInstance() { ... ... pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); HICON hIcon = LoadIcon(IDR_CHANGED); pMainFrame->SetIcon(hIcon, TRUE); pMainFrame->SetIcon(hIcon, FALSE); } regards ~Hari~

            J 1 Reply Last reply
            0
            • H Hari Krishnan Noida

              Hi, Here is the way to change the icon programmatically, CSomeApp::InitInstance() { ... ... pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); HICON hIcon = LoadIcon(IDR_CHANGED); pMainFrame->SetIcon(hIcon, TRUE); pMainFrame->SetIcon(hIcon, FALSE); } regards ~Hari~

              J Offline
              J Offline
              JensB
              wrote on last edited by
              #6

              yeah you can use that. I always use the constructor of the dialog: CDlgDialog::CDlgDialog(CWnd* pParent /*=NULL*/) : CDialog(CDlgDialog::IDD, pParent) { //{{AFX_DATA_INIT(CXyKeyGeneraterDlg) //}}AFX_DATA_INIT m_hIcon = AfxGetApp()->LoadIcon(IDR_ICONNAME); } just change the IDR_ICONNAME to your ico's inserted name. but it's all the same actually. Btw, do you know any websites where i can download seperate .ico files like the 'key' security icon? Greetings Jens

              G 1 Reply Last reply
              0
              • J JensB

                yeah you can use that. I always use the constructor of the dialog: CDlgDialog::CDlgDialog(CWnd* pParent /*=NULL*/) : CDialog(CDlgDialog::IDD, pParent) { //{{AFX_DATA_INIT(CXyKeyGeneraterDlg) //}}AFX_DATA_INIT m_hIcon = AfxGetApp()->LoadIcon(IDR_ICONNAME); } just change the IDR_ICONNAME to your ico's inserted name. but it's all the same actually. Btw, do you know any websites where i can download seperate .ico files like the 'key' security icon? Greetings Jens

                G Offline
                G Offline
                gmlnd
                wrote on last edited by
                #7

                No, I don't know any websites, let me know if you find any. Azi.

                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