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. how to use an interface as a parameter in other atl objects?

how to use an interface as a parameter in other atl objects?

Scheduled Pinned Locked Moved ATL / WTL / STL
tutorialc++question
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.
  • A Offline
    A Offline
    astupidboy
    wrote on last edited by
    #1

    :( first sorry for my poor english.. i have an "ATL simple object" interface like "IErrSupport" , and i want to use it as a parameter like: (ISomething) DoSomething(...,IErrSupport *pErr); ... (IOtherthing) DoOtherthing(...,IErrSupport *pErr); can anybody give me an example? thanks a lot.

    L 1 Reply Last reply
    0
    • A astupidboy

      :( first sorry for my poor english.. i have an "ATL simple object" interface like "IErrSupport" , and i want to use it as a parameter like: (ISomething) DoSomething(...,IErrSupport *pErr); ... (IOtherthing) DoOtherthing(...,IErrSupport *pErr); can anybody give me an example? thanks a lot.

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

      (IOtherthing) DoOtherthing(...,IErrSupport *pErr);

      Assuming that pErr points to an object that implements IErrSupport then you already have it.

      speaking as ...

      A 2 Replies Last reply
      0
      • L Lost User

        (IOtherthing) DoOtherthing(...,IErrSupport *pErr);

        Assuming that pErr points to an object that implements IErrSupport then you already have it.

        speaking as ...

        A Offline
        A Offline
        astupidboy
        wrote on last edited by
        #3

        i assumed like that ,but i don't know what to do . my step: 1. crete a new atl project, maybe it named TestA. 2. Add a class "A"; 3. IA Add methods like TestErr(IErrSupport *pErr); 4. compiling... .\TestA.idl(19) : error MIDL2025 : syntax error : expecting a type specification near "IErrSupport" .\TestA.idl(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation 5. add import "../ErrSupport/ErrSupport.idl"; to TestA.idl ,compiling... d:\errsupport\testa\testa_i.h(69) : fatal error C1083: Cannot open include file: 'ErrSupport.h': No such file or directory

        L B 2 Replies Last reply
        0
        • A astupidboy

          i assumed like that ,but i don't know what to do . my step: 1. crete a new atl project, maybe it named TestA. 2. Add a class "A"; 3. IA Add methods like TestErr(IErrSupport *pErr); 4. compiling... .\TestA.idl(19) : error MIDL2025 : syntax error : expecting a type specification near "IErrSupport" .\TestA.idl(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation 5. add import "../ErrSupport/ErrSupport.idl"; to TestA.idl ,compiling... d:\errsupport\testa\testa_i.h(69) : fatal error C1083: Cannot open include file: 'ErrSupport.h': No such file or directory

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

          astupidboy wrote:

          fatal error C1083: Cannot open include file: 'ErrSupport.h': No such file or directory

          That should give you a clue.

          speaking as ...

          A 1 Reply Last reply
          0
          • L Lost User

            (IOtherthing) DoOtherthing(...,IErrSupport *pErr);

            Assuming that pErr points to an object that implements IErrSupport then you already have it.

            speaking as ...

            A Offline
            A Offline
            astupidboy
            wrote on last edited by
            #5

            any example?:(,i'm too stupid

            1 Reply Last reply
            0
            • L Lost User

              astupidboy wrote:

              fatal error C1083: Cannot open include file: 'ErrSupport.h': No such file or directory

              That should give you a clue.

              speaking as ...

              A Offline
              A Offline
              astupidboy
              wrote on last edited by
              #6

              but there's no such file ... could you leave your email,and i send the project to you ?

              L 1 Reply Last reply
              0
              • A astupidboy

                but there's no such file ... could you leave your email,and i send the project to you ?

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

                astupidboy wrote:

                but there's no such file

                Then you need to create it.

                astupidboy wrote:

                could you leave your email,and i send the project to you ?

                Sorry, no, I'm not an ATL expert, and don't have the tools to build it.

                speaking as ...

                A 1 Reply Last reply
                0
                • L Lost User

                  astupidboy wrote:

                  but there's no such file

                  Then you need to create it.

                  astupidboy wrote:

                  could you leave your email,and i send the project to you ?

                  Sorry, no, I'm not an ATL expert, and don't have the tools to build it.

                  speaking as ...

                  A Offline
                  A Offline
                  astupidboy
                  wrote on last edited by
                  #8

                  Um,i see ,thank you

                  1 Reply Last reply
                  0
                  • A astupidboy

                    i assumed like that ,but i don't know what to do . my step: 1. crete a new atl project, maybe it named TestA. 2. Add a class "A"; 3. IA Add methods like TestErr(IErrSupport *pErr); 4. compiling... .\TestA.idl(19) : error MIDL2025 : syntax error : expecting a type specification near "IErrSupport" .\TestA.idl(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation 5. add import "../ErrSupport/ErrSupport.idl"; to TestA.idl ,compiling... d:\errsupport\testa\testa_i.h(69) : fatal error C1083: Cannot open include file: 'ErrSupport.h': No such file or directory

                    B Offline
                    B Offline
                    barneyman
                    wrote on last edited by
                    #9

                    You need to include the ErrSupport.idl into your project, so that the TLB and H are created by the MIDL compiler, in order that your import statement works you may need also need to add an importlib in your library block too, if you want to marshal that interface The above is a precis of some comments in some of my code from a few years ago, with the following link, that may provide more help - http://groups.google.com.au/group/microsoft.public.vc.atl/browse_thread/thread/7ca944c27b0288f4/9e1752e6feb4972a?lnk=st&q=import+common+idl#9e1752e6feb4972a[^]

                    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