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 do I remove a function in ATL ?

How do I remove a function in ATL ?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helplearning
15 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.
  • C Christian Graus

    I did have one problem one time, but it turned out that I named an H file with the same name as a system file (i.e. version.h), thus the compiler would always ignore changes to that file as far as requiring rebuilds. Sounds like the debugging problem from hell !! I've got a feeling when I go through and delete every piece of code with the name of my function, some of the funky looking stuff I delete should be left or changed, I'm just not sure what. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

    T Offline
    T Offline
    Tim Smith
    wrote on last edited by
    #6

    Is this in conjunction with the class wizard? If so, that could explain why I have never seen any type of problem like that. I have always been too bullheaded and lazy to learn those classwizards. :) Tim Smith Descartes Systems Sciences, Inc.

    C 1 Reply Last reply
    0
    • T Tim Smith

      Is this in conjunction with the class wizard? If so, that could explain why I have never seen any type of problem like that. I have always been too bullheaded and lazy to learn those classwizards. :) Tim Smith Descartes Systems Sciences, Inc.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #7

      The classwizard does not support removing functions, although I used it to add them ( well it's not the classwizard, but I assume you mean the class view ). Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

      T 1 Reply Last reply
      0
      • C Christian Graus

        The classwizard does not support removing functions, although I used it to add them ( well it's not the classwizard, but I assume you mean the class view ). Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

        T Offline
        T Offline
        Tim Smith
        wrote on last edited by
        #8

        Yeah, that is what I ment. Tim Smith Descartes Systems Sciences, Inc.

        1 Reply Last reply
        0
        • C Christian Graus

          I have an ATL project that started as a learning project but has come to a point of having code I would like to use. The problem is that on the way I created some functions I want to remove, but doing so breaks everything, in the least it stops mew adding more methods. Can anyone tell me how I'm supposed to do this ? Each function seems to have residue all over the place... Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

          D Offline
          D Offline
          Derek Waters
          wrote on last edited by
          #9

          Hi Christian, Sorry if this sounds like a really stupid question, but do you mean exported COM methods? Have you deleted them from the IDL and renumbered all of your IDL functions? For example:

          [id(1), helpstring("method ExecuteSql")] HRESULT ExecuteSql([in] VARIANT avCommand, [out] VARIANT *apvResponse);
          [id(2), helpstring("method ExecuteDml")] HRESULT ExecuteDml([in] VARIANT avCommand, [out] VARIANT *apvResponse);
          [id(3), helpstring("method GetStatus")] HRESULT GetStatus([out] long *aplStatus);

          Then, trying to delete ExecuteDML, you would need:

          [id(1), helpstring("method ExecuteSql")] HRESULT ExecuteSql([in] VARIANT avCommand, [out] VARIANT *apvResponse);
          [id(2), helpstring("method GetStatus")] HRESULT GetStatus([out] long *aplStatus);

          remembering to renumber the method to 2. All of this is in addition to removing the functions from the .h and .cpp files associated with the IDL. Again, sorry if this seems obvious, but my experience has always shown that it's the obvious things you miss... Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

          C 1 Reply Last reply
          0
          • D Derek Waters

            Hi Christian, Sorry if this sounds like a really stupid question, but do you mean exported COM methods? Have you deleted them from the IDL and renumbered all of your IDL functions? For example:

            [id(1), helpstring("method ExecuteSql")] HRESULT ExecuteSql([in] VARIANT avCommand, [out] VARIANT *apvResponse);
            [id(2), helpstring("method ExecuteDml")] HRESULT ExecuteDml([in] VARIANT avCommand, [out] VARIANT *apvResponse);
            [id(3), helpstring("method GetStatus")] HRESULT GetStatus([out] long *aplStatus);

            Then, trying to delete ExecuteDML, you would need:

            [id(1), helpstring("method ExecuteSql")] HRESULT ExecuteSql([in] VARIANT avCommand, [out] VARIANT *apvResponse);
            [id(2), helpstring("method GetStatus")] HRESULT GetStatus([out] long *aplStatus);

            remembering to renumber the method to 2. All of this is in addition to removing the functions from the .h and .cpp files associated with the IDL. Again, sorry if this seems obvious, but my experience has always shown that it's the obvious things you miss... Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #10

            To be honest, it's my recollection that I expected to have to do that but couldn't find where it was. I also deleted the weird lookin' stuff that was associated with my function and looked to me like it was specifying offsets in memory for functions & variables, is that right ? Thanks for the help. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

            D 1 Reply Last reply
            0
            • C Christian Graus

              To be honest, it's my recollection that I expected to have to do that but couldn't find where it was. I also deleted the weird lookin' stuff that was associated with my function and looked to me like it was specifying offsets in memory for functions & variables, is that right ? Thanks for the help. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

              D Offline
              D Offline
              Derek Waters
              wrote on last edited by
              #11

              Yeah, the IDL is contained in the .dil file in your interface definition. Having a quick look at the example project I was using, the only line I would have removed from the .h file was:

              STDMETHOD(ExecuteDml)(/*[in]*/ VARIANT avCommand, /*[out]*/ VARIANT *apvResponse);

              and also the corresponding implementation in .cpp. I think that's about it. You will, though, have to make sure that the MIDL compiler regenerates the main project .h file which contains the stubs that wrap around the COM calls. If you've screwed around with this file, I'd try deleting it, modifying your IDL so the MIDL compiler fires off again and regenerating. The id numbers in the IDL specify the function offsets in the COM object. These definitely have to be sequentially increasing. Any missing or mis-ordered numbers cause things to go very askew (as I've found out from experience). ------------------------ Derek Waters derek@lj-oz.com

              C 1 Reply Last reply
              0
              • D Derek Waters

                Yeah, the IDL is contained in the .dil file in your interface definition. Having a quick look at the example project I was using, the only line I would have removed from the .h file was:

                STDMETHOD(ExecuteDml)(/*[in]*/ VARIANT avCommand, /*[out]*/ VARIANT *apvResponse);

                and also the corresponding implementation in .cpp. I think that's about it. You will, though, have to make sure that the MIDL compiler regenerates the main project .h file which contains the stubs that wrap around the COM calls. If you've screwed around with this file, I'd try deleting it, modifying your IDL so the MIDL compiler fires off again and regenerating. The id numbers in the IDL specify the function offsets in the COM object. These definitely have to be sequentially increasing. Any missing or mis-ordered numbers cause things to go very askew (as I've found out from experience). ------------------------ Derek Waters derek@lj-oz.com

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #12

                Ah.... *light comes on* So if I remove the .h and .cpp references to the fucntion, and the IDL reference which has the number, the compiler will fix the rest ? Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                D 1 Reply Last reply
                0
                • C Christian Graus

                  Ah.... *light comes on* So if I remove the .h and .cpp references to the fucntion, and the IDL reference which has the number, the compiler will fix the rest ? Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                  D Offline
                  D Offline
                  Derek Waters
                  wrote on last edited by
                  #13

                  Yep. At least, that is my belief, without wanting to 100%, no doubt, absolutely stake my life on the behaviour of Visual C++... ------------------------ Derek Waters derek@lj-oz.com

                  C 1 Reply Last reply
                  0
                  • D Derek Waters

                    Yep. At least, that is my belief, without wanting to 100%, no doubt, absolutely stake my life on the behaviour of Visual C++... ------------------------ Derek Waters derek@lj-oz.com

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #14

                    Thanks for the help - I'll backup my project tonight and give that a try. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                    1 Reply Last reply
                    0
                    • C Christian Graus

                      I have an ATL project that started as a learning project but has come to a point of having code I would like to use. The problem is that on the way I created some functions I want to remove, but doing so breaks everything, in the least it stops mew adding more methods. Can anyone tell me how I'm supposed to do this ? Each function seems to have residue all over the place... Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.

                      A Offline
                      A Offline
                      asfas
                      wrote on last edited by
                      #15

                      (1) Remove the function declaration from the IDL file (2) Remove the function declaration from the implementation class (3) Remove the function implementation from the implementation class (4) Rebuild the project Mohamed Mabrouk

                      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