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. How to inherit a MFC class.

How to inherit a MFC class.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++jsontutorial
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.
  • C Offline
    C Offline
    chaitannya_m
    wrote on last edited by
    #1

    Hi everyone, In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z) All the errors are related to the WM and NM .I guess the problem is in BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.

    B S S J 4 Replies Last reply
    0
    • C chaitannya_m

      Hi everyone, In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z) All the errors are related to the WM and NM .I guess the problem is in BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.

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

      Hi, could you please post some code, so that we see how you define the rest of the class Regards

      1 Reply Last reply
      0
      • C chaitannya_m

        Hi everyone, In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z) All the errors are related to the WM and NM .I guess the problem is in BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.

        S Offline
        S Offline
        sps itsec46
        wrote on last edited by
        #3

        It's not really much info you posted but check if the declaration and definition of the method PreTranslateMessage() is correct. When I look at your BEGIN_MESSAGE_MAP macro your class seems to be called CCustomListCtrl but the definition of PreTranslateMessage() contains a class named CCustomList:

        CCustomList::PreTranslateMessage(struct tagMSG *)

        cheers, mykel OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."

        C 1 Reply Last reply
        0
        • C chaitannya_m

          Hi everyone, In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z) All the errors are related to the WM and NM .I guess the problem is in BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.

          S Offline
          S Offline
          Sam_c
          wrote on last edited by
          #4

          class to message map is incorrect CCustomListCrtl <- Message map CCustomList <- Class this could be the problem :) if it isnt a bit more code would help thanks :)

          1 Reply Last reply
          0
          • C chaitannya_m

            Hi everyone, In my application i am using a hell lot no. of list controls. So i have defined a CCustomListCtrl class derived from CListCtrl class. I have defined the NM and WM functionalities and other stuff in it and it runs just the way i want it. Now i want to define rest of the class derived from CCustomListCtrl. When i do this compiler gives an error unresolved external symbol "public: virtual int __thiscall CCustomList::PreTranslateMessage(struct tagMSG *)" (?PreTranslateMessage@CCustomList@@UAEHPAUtagMSG@@@Z) All the errors are related to the WM and NM .I guess the problem is in BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl) macro. How do i remove this error.

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            chaitannya_m wrote:

            BEGIN_MESSAGE_MAP(CCustomListCtrl, CListCtrl)

            The Syntax here is BEGIN_MESSAGE_MAP(Classname, Baseclassname) Did you turn it around?


            Failure is not an option - it's built right in.

            1 Reply Last reply
            0
            • S sps itsec46

              It's not really much info you posted but check if the declaration and definition of the method PreTranslateMessage() is correct. When I look at your BEGIN_MESSAGE_MAP macro your class seems to be called CCustomListCtrl but the definition of PreTranslateMessage() contains a class named CCustomList:

              CCustomList::PreTranslateMessage(struct tagMSG *)

              cheers, mykel OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."

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

              Hey thanks.. Great observation ...!!! the error was there.. There was another class CCustomList which i delete because i completely messed up with.. Code is working fine now

              S 1 Reply Last reply
              0
              • C chaitannya_m

                Hey thanks.. Great observation ...!!! the error was there.. There was another class CCustomList which i delete because i completely messed up with.. Code is working fine now

                S Offline
                S Offline
                sps itsec46
                wrote on last edited by
                #7

                You're welcome! Perhaps next time use search and replace when you rename your classes... ;P

                cheers, mykel OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."

                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