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. The destructor of MFC application [Solved]

The destructor of MFC application [Solved]

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionannouncementlearning
8 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.
  • E Offline
    E Offline
    econy
    wrote on last edited by
    #1

    Hi, in a modal dialog based MFC application, I use addFontResource() function to load font resource in application's InitInstance(). I want to use this font in all life of application. when application ends, then release the font resource. But I can't find the destructor of the modal dialog based MFC application, do I need to write it myself?

    D _ 2 Replies Last reply
    0
    • E econy

      Hi, in a modal dialog based MFC application, I use addFontResource() function to load font resource in application's InitInstance(). I want to use this font in all life of application. when application ends, then release the font resource. But I can't find the destructor of the modal dialog based MFC application, do I need to write it myself?

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

      See ExitInstance().

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      E 1 Reply Last reply
      0
      • D David Crow

        See ExitInstance().

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        E Offline
        E Offline
        econy
        wrote on last edited by
        #3

        It's a dialog based application, can't find

        ExitInstance()

        J 1 Reply Last reply
        0
        • E econy

          It's a dialog based application, can't find

          ExitInstance()

          J Offline
          J Offline
          jeron1
          wrote on last edited by
          #4

          Override it, easiest done with the class wizard.

          E 1 Reply Last reply
          0
          • J jeron1

            Override it, easiest done with the class wizard.

            E Offline
            E Offline
            econy
            wrote on last edited by
            #5

            is that means CDialog class has a ExitInstance() member function? inherited from ,maybe a parent class. I will check thhat

            J 1 Reply Last reply
            0
            • E econy

              is that means CDialog class has a ExitInstance() member function? inherited from ,maybe a parent class. I will check thhat

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

              It means that your Application object (derived from CWinApp) has an ExitInstance() override.

              1 Reply Last reply
              0
              • E econy

                Hi, in a modal dialog based MFC application, I use addFontResource() function to load font resource in application's InitInstance(). I want to use this font in all life of application. when application ends, then release the font resource. But I can't find the destructor of the modal dialog based MFC application, do I need to write it myself?

                _ Offline
                _ Offline
                _Superman_
                wrote on last edited by
                #7

                Since you're adding the font in the application's InitInstance method, it would be properly matched if you release it in ExitInstance[^]. It would also work if done in the destructor of the dialog class, but ExitInstance would be cleaner. The Visual Studio wizard does not normally output the dialog class destructor, but you could write one yourself as you would normally do and it will be called when the dialog class goes out of scope.

                «_Superman_»  _I love work. It gives me something to do between weekends.

                _Microsoft MVP (Visual C++) (October 2009 - September 2013)

                Polymorphism in C

                E 1 Reply Last reply
                0
                • _ _Superman_

                  Since you're adding the font in the application's InitInstance method, it would be properly matched if you release it in ExitInstance[^]. It would also work if done in the destructor of the dialog class, but ExitInstance would be cleaner. The Visual Studio wizard does not normally output the dialog class destructor, but you could write one yourself as you would normally do and it will be called when the dialog class goes out of scope.

                  «_Superman_»  _I love work. It gives me something to do between weekends.

                  _Microsoft MVP (Visual C++) (October 2009 - September 2013)

                  Polymorphism in C

                  E Offline
                  E Offline
                  econy
                  wrote on last edited by
                  #8

                  Thanks, Now I understand

                  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