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. ATL / WTL / STL
  4. Quick way to generate C++ files from an IDL file

Quick way to generate C++ files from an IDL file

Scheduled Pinned Locked Moved ATL / WTL / STL
c++comhelpquestion
9 Posts 3 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.
  • T Offline
    T Offline
    TClarke
    wrote on last edited by
    #1

    I have to create an ActiveX control from a huge .IDL file. I have no problem creating a class to control the control but there seems to be a lot of leg work in writing out the declaration, definition, dispatch enumeration and dispatch map when creating the control class. Apart from manually running through the properties and methods in the IDL file is there a way of automating this process instead? Thanks Tom It will always be the bane of the civilized as to what to do with the barbarian

    S S 2 Replies Last reply
    0
    • T TClarke

      I have to create an ActiveX control from a huge .IDL file. I have no problem creating a class to control the control but there seems to be a lot of leg work in writing out the declaration, definition, dispatch enumeration and dispatch map when creating the control class. Apart from manually running through the properties and methods in the IDL file is there a way of automating this process instead? Thanks Tom It will always be the bane of the civilized as to what to do with the barbarian

      S Offline
      S Offline
      Steve S
      wrote on last edited by
      #2

      In VC6, once you'd built the IDL there was an 'implement interface' option. Can't remember exactly where, since I saw it demo-ed on a COM course once, and never used it myself, since I preferred to go through and do it by hand to help reinforce my memory :) Don't know if there's an equivalent in later VS though, as I wouldn't use it if there was ...

      Steve S Developer for hire

      1 Reply Last reply
      0
      • T TClarke

        I have to create an ActiveX control from a huge .IDL file. I have no problem creating a class to control the control but there seems to be a lot of leg work in writing out the declaration, definition, dispatch enumeration and dispatch map when creating the control class. Apart from manually running through the properties and methods in the IDL file is there a way of automating this process instead? Thanks Tom It will always be the bane of the civilized as to what to do with the barbarian

        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        Ummm - use ATL? That'll do the IDispatch implementation for you if you ask it nicely, as well as loads of other interfaces - I just created an ATL Control class in VS2003 and it looks like it'll implement these interfaces for you: IDispatch, IPersistStreamInit, IOleControl, IOleObject, IOleInPlaceActiveObject, IViewObjectEx, IOleInPlaceObjectWindowless, IPersistStorage, ISpecifyPropertyPages, IQuickActivate, IDataObject, IProvideClassInfo2

        T 1 Reply Last reply
        0
        • S Stuart Dootson

          Ummm - use ATL? That'll do the IDispatch implementation for you if you ask it nicely, as well as loads of other interfaces - I just created an ATL Control class in VS2003 and it looks like it'll implement these interfaces for you: IDispatch, IPersistStreamInit, IOleControl, IOleObject, IOleInPlaceActiveObject, IViewObjectEx, IOleInPlaceObjectWindowless, IPersistStorage, ISpecifyPropertyPages, IQuickActivate, IDataObject, IProvideClassInfo2

          T Offline
          T Offline
          TClarke
          wrote on last edited by
          #4

          Thanks for the responses guys :) I agree with your do it your self attitude but this interface has literally hundreds of events, methods and properties and I start to go a bit nuts after a while of doing that much repetitive work. Unfortunately, I've failed at failed at finding any assistance from VC2005. so I've decided I'd rather write a parser myself than manually go through it all. Is there a document that lists the complete spec for IDL files? and would anyone be interested in me publishing the resulting app? Thanks again Tom It will always be the bane of the civilised as to what to do with the barbarian

          S S 2 Replies Last reply
          0
          • T TClarke

            Thanks for the responses guys :) I agree with your do it your self attitude but this interface has literally hundreds of events, methods and properties and I start to go a bit nuts after a while of doing that much repetitive work. Unfortunately, I've failed at failed at finding any assistance from VC2005. so I've decided I'd rather write a parser myself than manually go through it all. Is there a document that lists the complete spec for IDL files? and would anyone be interested in me publishing the resulting app? Thanks again Tom It will always be the bane of the civilised as to what to do with the barbarian

            S Offline
            S Offline
            Steve S
            wrote on last edited by
            #5

            Would it be less work to use the type library instead of the IDL ?

            Steve S Developer for hire

            T 1 Reply Last reply
            0
            • S Steve S

              Would it be less work to use the type library instead of the IDL ?

              Steve S Developer for hire

              T Offline
              T Offline
              TClarke
              wrote on last edited by
              #6

              Hi Steve Hmmm... I'm not sure. The control has to have all the functionality of the old contol but certain of the methods, events and properties require modification. It also has to fit into alot of legacy JavaScript functions and I can only change the GUID which luckily I put into a resource file but modifying the JavaScript is out of the question. The reason I say this is that I am unaware of how to achieve this effect using a type library. A nifty alternative would be great but I haven't thought of one. Thanks tom

              1 Reply Last reply
              0
              • T TClarke

                Thanks for the responses guys :) I agree with your do it your self attitude but this interface has literally hundreds of events, methods and properties and I start to go a bit nuts after a while of doing that much repetitive work. Unfortunately, I've failed at failed at finding any assistance from VC2005. so I've decided I'd rather write a parser myself than manually go through it all. Is there a document that lists the complete spec for IDL files? and would anyone be interested in me publishing the resulting app? Thanks again Tom It will always be the bane of the civilised as to what to do with the barbarian

                S Offline
                S Offline
                Stuart Dootson
                wrote on last edited by
                #7

                OK - I think I've got an automated solution for you. Note - this was done with VS2003...

                1. Create an ATL DLL project.
                2. Add an 'ATL Control' class. Use some throwaway name for the control interface (because you *will* be throwing it away :)), but make sure the class names are ones you're happy with.
                3. Copy'n'paste your IDL interface into the new projects IDL file
                4. In the Class View, right click the ATL Control class and select Add->Implement Interface... The interface you want to implement should be in the dialog that appears. Select it and click Finish. This should create bare method definitions.

                Note that I've not determined what happens to event definitions.

                T S 2 Replies Last reply
                0
                • S Stuart Dootson

                  OK - I think I've got an automated solution for you. Note - this was done with VS2003...

                  1. Create an ATL DLL project.
                  2. Add an 'ATL Control' class. Use some throwaway name for the control interface (because you *will* be throwing it away :)), but make sure the class names are ones you're happy with.
                  3. Copy'n'paste your IDL interface into the new projects IDL file
                  4. In the Class View, right click the ATL Control class and select Add->Implement Interface... The interface you want to implement should be in the dialog that appears. Select it and click Finish. This should create bare method definitions.

                  Note that I've not determined what happens to event definitions.

                  T Offline
                  T Offline
                  TClarke
                  wrote on last edited by
                  #8

                  Fantastic solution :-D Worked like a treat! Events too! Thanks loads Tom It will always be the bane of the civilised as to what to do with the barbarian

                  1 Reply Last reply
                  0
                  • S Stuart Dootson

                    OK - I think I've got an automated solution for you. Note - this was done with VS2003...

                    1. Create an ATL DLL project.
                    2. Add an 'ATL Control' class. Use some throwaway name for the control interface (because you *will* be throwing it away :)), but make sure the class names are ones you're happy with.
                    3. Copy'n'paste your IDL interface into the new projects IDL file
                    4. In the Class View, right click the ATL Control class and select Add->Implement Interface... The interface you want to implement should be in the dialog that appears. Select it and click Finish. This should create bare method definitions.

                    Note that I've not determined what happens to event definitions.

                    S Offline
                    S Offline
                    Steve S
                    wrote on last edited by
                    #9

                    Ah. That's how you get to it. I knew it was around here somewhere :)

                    Steve S Developer for hire

                    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