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. COM
  4. How to use COM in such condition?

How to use COM in such condition?

Scheduled Pinned Locked Moved COM
comdesignsysadminarchitecturehelp
9 Posts 2 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.
  • K Offline
    K Offline
    kcynic
    wrote on last edited by
    #1

    im a com beginner, i know its more complex than normal usage. Here i list some classes as following: class A{ //...some member variables, such as c strings, and other class variables }; class B{ //...some member variables, such as c strings, and other class variables }; class C{ //...some member variables, such as c strings, and other class variables A* m_pAobjects; B* m_pBobjects; }; In the project, there would be only one instance of class C, but there would be more than one B instances and A instance; And i can create one C instance, which will read some data from some files or generate some data on the fly; and i can get the count of its internal A or B instances, retrieve specified objects from the instances. But, i don't know how to design the project to com architecture. My main problem is,how to design and implement the interfaces? and how to transfer the parameters between the com client and the server? thanks

    J 1 Reply Last reply
    0
    • K kcynic

      im a com beginner, i know its more complex than normal usage. Here i list some classes as following: class A{ //...some member variables, such as c strings, and other class variables }; class B{ //...some member variables, such as c strings, and other class variables }; class C{ //...some member variables, such as c strings, and other class variables A* m_pAobjects; B* m_pBobjects; }; In the project, there would be only one instance of class C, but there would be more than one B instances and A instance; And i can create one C instance, which will read some data from some files or generate some data on the fly; and i can get the count of its internal A or B instances, retrieve specified objects from the instances. But, i don't know how to design the project to com architecture. My main problem is,how to design and implement the interfaces? and how to transfer the parameters between the com client and the server? thanks

      J Offline
      J Offline
      Jonathan Davies
      wrote on last edited by
      #2

      As a start: Find something on Unified Modelling Language (UML) related to COM, though be careful as some UML descriptions can get a bit complicated. Basically get some paper, draw your COM objects as boxes and any interface such as IUnknown or IMySettings as, well, 'lollipop' or spoon shapes on those boxes. Find a few examples and you'l see what I mean. Then try a sequence diagram to show the messages (calls) between the COM objects. Once you're satisfied you have the messages sorted you need to design interfaces to provide methods which convey those messages.

      J K 3 Replies Last reply
      0
      • J Jonathan Davies

        As a start: Find something on Unified Modelling Language (UML) related to COM, though be careful as some UML descriptions can get a bit complicated. Basically get some paper, draw your COM objects as boxes and any interface such as IUnknown or IMySettings as, well, 'lollipop' or spoon shapes on those boxes. Find a few examples and you'l see what I mean. Then try a sequence diagram to show the messages (calls) between the COM objects. Once you're satisfied you have the messages sorted you need to design interfaces to provide methods which convey those messages.

        J Offline
        J Offline
        Jonathan Davies
        wrote on last edited by
        #3

        This sort of thing: [^]

        1 Reply Last reply
        0
        • J Jonathan Davies

          As a start: Find something on Unified Modelling Language (UML) related to COM, though be careful as some UML descriptions can get a bit complicated. Basically get some paper, draw your COM objects as boxes and any interface such as IUnknown or IMySettings as, well, 'lollipop' or spoon shapes on those boxes. Find a few examples and you'l see what I mean. Then try a sequence diagram to show the messages (calls) between the COM objects. Once you're satisfied you have the messages sorted you need to design interfaces to provide methods which convey those messages.

          K Offline
          K Offline
          kcynic
          wrote on last edited by
          #4

          im agree with you. Although i know little about uml, im puzzled by this condition. But it can be designed in plain C++ easily. About COM, at this condition, class C can be implements as interface C is easy, but how to retrieve its internal instances B or A? No matter C delegate A and B or C contain B and C, there would be more than one interfaces be created...... i think i have not understand the between COM interface and COM object.

          1 Reply Last reply
          0
          • J Jonathan Davies

            As a start: Find something on Unified Modelling Language (UML) related to COM, though be careful as some UML descriptions can get a bit complicated. Basically get some paper, draw your COM objects as boxes and any interface such as IUnknown or IMySettings as, well, 'lollipop' or spoon shapes on those boxes. Find a few examples and you'l see what I mean. Then try a sequence diagram to show the messages (calls) between the COM objects. Once you're satisfied you have the messages sorted you need to design interfaces to provide methods which convey those messages.

            K Offline
            K Offline
            kcynic
            wrote on last edited by
            #5

            thanks for you advise. After i read the implement about ADO database, i know how to designed such com interfaces for such condition.

            J 1 Reply Last reply
            0
            • K kcynic

              thanks for you advise. After i read the implement about ADO database, i know how to designed such com interfaces for such condition.

              J Offline
              J Offline
              Jonathan Davies
              wrote on last edited by
              #6

              As you mention, you can't really consider designing how to implement COM objects in, say, C++ until you are up to speed with COM Objects and Interfaces and have some idea of how they can be used.

              K 1 Reply Last reply
              0
              • J Jonathan Davies

                As you mention, you can't really consider designing how to implement COM objects in, say, C++ until you are up to speed with COM Objects and Interfaces and have some idea of how they can be used.

                K Offline
                K Offline
                kcynic
                wrote on last edited by
                #7

                yes. im just a newbie for com. But the question is upgrading, although i had learnt how to implement it from ADO. Here, class A has B type member pointer, but B is a union type, which can point to a A object or anther different object: class A{ //some other members struct B* m_pB; }; struct B{ int type;//indicate the type of next field union{ char* szText; class A* pA; }data; }; if i translate it to interface, that, i can get IB from IA, but if IB instance's data field point to any IA object, how should i get the IA object? if i get IA object as normal, the previous IA object,the owner of IB, would lost its attributes! right?

                J 1 Reply Last reply
                0
                • K kcynic

                  yes. im just a newbie for com. But the question is upgrading, although i had learnt how to implement it from ADO. Here, class A has B type member pointer, but B is a union type, which can point to a A object or anther different object: class A{ //some other members struct B* m_pB; }; struct B{ int type;//indicate the type of next field union{ char* szText; class A* pA; }data; }; if i translate it to interface, that, i can get IB from IA, but if IB instance's data field point to any IA object, how should i get the IA object? if i get IA object as normal, the previous IA object,the owner of IB, would lost its attributes! right?

                  J Offline
                  J Offline
                  Jonathan Davies
                  wrote on last edited by
                  #8

                  Your Inside COM should tell you most of this. Again concentrate on COM objects and Interfaces or some examples and you will realise how to phrase 'IB instance's data field' in COM terms.

                  K 1 Reply Last reply
                  0
                  • J Jonathan Davies

                    Your Inside COM should tell you most of this. Again concentrate on COM objects and Interfaces or some examples and you will realise how to phrase 'IB instance's data field' in COM terms.

                    K Offline
                    K Offline
                    kcynic
                    wrote on last edited by
                    #9

                    I really have that book, and i had read it twice, in fact. I will study harder to do that work. Thank you. Regards.

                    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