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. Is it possible to recompile MFC source code to some dlls?

Is it possible to recompile MFC source code to some dlls?

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studioquestion
7 Posts 5 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.
  • F Offline
    F Offline
    flyingxu
    wrote on last edited by
    #1

    In VS install directory, there're some files(.cpp, .h) seems to be source code of MFC. So can I put them back into VC and compile them?

    L P 2 Replies Last reply
    0
    • F flyingxu

      In VS install directory, there're some files(.cpp, .h) seems to be source code of MFC. So can I put them back into VC and compile them?

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

      Yes but if you make any changes you will need to distribute your new DLL(s) along with your app

      1 Reply Last reply
      0
      • F flyingxu

        In VS install directory, there're some files(.cpp, .h) seems to be source code of MFC. So can I put them back into VC and compile them?

        P Offline
        P Offline
        Peter Weyzen
        wrote on last edited by
        #3

        You can. But you really shouldn't do it unless you have a very good reason to do so. And I can't think of a good reason to. If you want to change the behavior of some class, just subclass it and handle it in that good old C++ way...

        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

        C 1 Reply Last reply
        0
        • P Peter Weyzen

          You can. But you really shouldn't do it unless you have a very good reason to do so. And I can't think of a good reason to. If you want to change the behavior of some class, just subclass it and handle it in that good old C++ way...

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

          C Offline
          C Offline
          code_discuss
          wrote on last edited by
          #4

          Oh...I'd like to have a try. Just to know MFC libray better. So are there any instructions about compiling MFC source code on the internet?

          M 1 Reply Last reply
          0
          • C code_discuss

            Oh...I'd like to have a try. Just to know MFC libray better. So are there any instructions about compiling MFC source code on the internet?

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            I'm not sure how building the library yourself will help you "know MFC libray better", but... Take a look in the atl/mfc src directory. For example, in VS 2005, there's a readme.txt that states:

            Building ATL and MFC

            To build either ATL or MFC open a command prompt and run vcvars32.bat from \bin
            Change directory to \atlmfc\src

            atlmfc.mak can be used to rebuild all ATL and MFC libraries and DLLs.
            Following is the command line you can specify with NMAKE

            nmake /f atlmfc.mak [ALL | ATL | MFC] [CLEAN= ] [LIBNAME= ] [PLATFORM= ]

            Targets
            	ALL - builds both ATL and MFC. This is the default target. LIBNAME has to be 
            

            specified.
            ATL - builds only ATL.
            MFC - builds only MFC. LIBNAME has to be specified.

            CLEAN=1 cleans the files generated by the specified targets
            
            LIBNAME="name of the MFCdll being built" - specifying MFC80 builds the prebuilt DLLs
            
            PLATFORM=\[AMD64|IA64\] if building for 64-bit on a 32-bit system
            

            Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

            C 1 Reply Last reply
            0
            • M Mark Salsbery

              I'm not sure how building the library yourself will help you "know MFC libray better", but... Take a look in the atl/mfc src directory. For example, in VS 2005, there's a readme.txt that states:

              Building ATL and MFC

              To build either ATL or MFC open a command prompt and run vcvars32.bat from \bin
              Change directory to \atlmfc\src

              atlmfc.mak can be used to rebuild all ATL and MFC libraries and DLLs.
              Following is the command line you can specify with NMAKE

              nmake /f atlmfc.mak [ALL | ATL | MFC] [CLEAN= ] [LIBNAME= ] [PLATFORM= ]

              Targets
              	ALL - builds both ATL and MFC. This is the default target. LIBNAME has to be 
              

              specified.
              ATL - builds only ATL.
              MFC - builds only MFC. LIBNAME has to be specified.

              CLEAN=1 cleans the files generated by the specified targets
              
              LIBNAME="name of the MFCdll being built" - specifying MFC80 builds the prebuilt DLLs
              
              PLATFORM=\[AMD64|IA64\] if building for 64-bit on a 32-bit system
              

              Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

              C Offline
              C Offline
              code_discuss
              wrote on last edited by
              #6

              Very long time ago, I just wondered why doesn't MFC add all Windows message handlers to CWnd and make them all virtual, so that derived classed don't need to add message handlers but only to override virtual functions. MFC claims that it uses message maps rather than virtual functions just in order to tune the performance, now it's time to tell the real difference. ;-)

              M 1 Reply Last reply
              0
              • C code_discuss

                Very long time ago, I just wondered why doesn't MFC add all Windows message handlers to CWnd and make them all virtual, so that derived classed don't need to add message handlers but only to override virtual functions. MFC claims that it uses message maps rather than virtual functions just in order to tune the performance, now it's time to tell the real difference. ;-)

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                Cool. Let us know the results! From Technical Note TN006: "Microsoft Windows implements what are essentially virtual functions in window classes using its messaging facility. Due to the large number of messages involved, providing a separate virtual function for each Windows message results in a prohibitively large vtable. Also, since the number of system-defined Windows messages changes over time, and since a specific application may want to define some Windows messages of its own, the message-map mechanism provides a level of indirection that prevents interface changes from breaking existing code."

                Mark Salsbery Microsoft MVP - Visual C++ "Great job team! Head back to base for debriefing and cocktails."

                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