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. Cant find insert section "AFX_MSG"

Cant find insert section "AFX_MSG"

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
9 Posts 5 Posters 1 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.
  • R Offline
    R Offline
    raner
    wrote on last edited by
    #1

    Hi I am creating a CObject-derived class by first creating a class with CDocument as base class, and then replacing all 'CDocument' with 'CObject' and then removing the below message maps functions from the source and header files. BEGIN_MESSAGE_MAP(CMyClass, CObject) //{{AFX_MSG_MAP(CMyClass) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() and // Generated message map functions protected: //{{AFX_MSG(CMyClass) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG DECLARE_MESSAGE_MAP() I have no problem compiling the program but when i try to use the class wizard, an error dialog box appeared with: "Cannot find the insert section "AFX_MSG" in file.Class wizard cannot import or edit this class." Anyone with suggestions as to what i should do?

    C 1 Reply Last reply
    0
    • R raner

      Hi I am creating a CObject-derived class by first creating a class with CDocument as base class, and then replacing all 'CDocument' with 'CObject' and then removing the below message maps functions from the source and header files. BEGIN_MESSAGE_MAP(CMyClass, CObject) //{{AFX_MSG_MAP(CMyClass) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() and // Generated message map functions protected: //{{AFX_MSG(CMyClass) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG DECLARE_MESSAGE_MAP() I have no problem compiling the program but when i try to use the class wizard, an error dialog box appeared with: "Cannot find the insert section "AFX_MSG" in file.Class wizard cannot import or edit this class." Anyone with suggestions as to what i should do?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      why did you remove those blocks of code? they are (obviously) what the CW is looking for. -c


      Zzzzz...

      ThumbNailer

      R 1 Reply Last reply
      0
      • C Chris Losinger

        why did you remove those blocks of code? they are (obviously) what the CW is looking for. -c


        Zzzzz...

        ThumbNailer

        R Offline
        R Offline
        raner
        wrote on last edited by
        #3

        because what i actually want is a CObject-derived class, not CDocument-derived. And CObject-derived classes has no no message mapping.(This method of deriving from CObject class is taught by someone) Actually, why does it want to find the insert section for "AFX_MSG"? thks thks

        R R C 3 Replies Last reply
        0
        • R raner

          because what i actually want is a CObject-derived class, not CDocument-derived. And CObject-derived classes has no no message mapping.(This method of deriving from CObject class is taught by someone) Actually, why does it want to find the insert section for "AFX_MSG"? thks thks

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #4

          raner wrote: Actually, why does it want to find the insert section for "AFX_MSG"? MFC needs it for message mapping. Maybe you did not remove everything needed. Actually, to derive a class from a CObject, you only need to add the class with the wizard, and say you want it to be derived from CObject. ~RaGE();

          1 Reply Last reply
          0
          • R raner

            because what i actually want is a CObject-derived class, not CDocument-derived. And CObject-derived classes has no no message mapping.(This method of deriving from CObject class is taught by someone) Actually, why does it want to find the insert section for "AFX_MSG"? thks thks

            R Offline
            R Offline
            Roger Allen
            wrote on last edited by
            #5

            raner wrote: Actually, why does it want to find the insert section for "AFX_MSG"? Its a guess but: Possibly becuase the CDocument object used the DECLARE_SERIAL() / IMPLEMENT_SERIAL() macros and you need to switch to DECLARE_DYNAMIC() / IMPLEMENT_DYNAMIC() ? Roger Allen Sonork 100.10016 This is a multiple choice question, choose wisely Why did the hedgehog cross the road? A: To show he had guts? B: To see his flat mate?

            R 1 Reply Last reply
            0
            • R Roger Allen

              raner wrote: Actually, why does it want to find the insert section for "AFX_MSG"? Its a guess but: Possibly becuase the CDocument object used the DECLARE_SERIAL() / IMPLEMENT_SERIAL() macros and you need to switch to DECLARE_DYNAMIC() / IMPLEMENT_DYNAMIC() ? Roger Allen Sonork 100.10016 This is a multiple choice question, choose wisely Why did the hedgehog cross the road? A: To show he had guts? B: To see his flat mate?

              R Offline
              R Offline
              raner
              wrote on last edited by
              #6

              i did not see the DECLARE_SERIAL() / IMPLEMENT_SERIAL() macros but i saw the DECLARE/IMPLEMENT_DYNCREATE macros pair...does it matter? thks

              1 Reply Last reply
              0
              • R raner

                because what i actually want is a CObject-derived class, not CDocument-derived. And CObject-derived classes has no no message mapping.(This method of deriving from CObject class is taught by someone) Actually, why does it want to find the insert section for "AFX_MSG"? thks thks

                C Offline
                C Offline
                Chris Losinger
                wrote on last edited by
                #7

                a better question is: if you don't need message mapping, what do you need the CW for? -c


                Zzzzz...

                ThumbNailer

                R 1 Reply Last reply
                0
                • C Chris Losinger

                  a better question is: if you don't need message mapping, what do you need the CW for? -c


                  Zzzzz...

                  ThumbNailer

                  R Offline
                  R Offline
                  raner
                  wrote on last edited by
                  #8

                  actually i don't really need the class wizard for that class...but the error message appearing every time i activate the CW seem to mean that something is terribly wrong? So i thought if i don't fix it now, it's bound to give me problems someday? was i wrong?

                  A 1 Reply Last reply
                  0
                  • R raner

                    actually i don't really need the class wizard for that class...but the error message appearing every time i activate the CW seem to mean that something is terribly wrong? So i thought if i don't fix it now, it's bound to give me problems someday? was i wrong?

                    A Offline
                    A Offline
                    Anonymous
                    wrote on last edited by
                    #9

                    in that case, i think you were right to delete those sections. and, i think you should get rid of any //{{AFX_* comments in there (leave any delcarations, etc. - just get rid of the comment lines). those are all the places CW is scanning. also, you should delete the *.CLW file for your project, then re-run CW. hopefully, it won't try to re-parse your class. -c

                    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