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. COM Object NameSpace

COM Object NameSpace

Scheduled Pinned Locked Moved COM
c++com
6 Posts 4 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.
  • J Offline
    J Offline
    Ju ncho
    wrote on last edited by
    #1

    Hi, I am programming a COM object in C++, to be used in a Visual Basic Apllication. I want to know if there is a way to separate the interface members with namespaces like this Study.FramesOfReference.Series.Item() where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item() Thank U very Much

    JO :)

    N K 2 Replies Last reply
    0
    • J Ju ncho

      Hi, I am programming a COM object in C++, to be used in a Visual Basic Apllication. I want to know if there is a way to separate the interface members with namespaces like this Study.FramesOfReference.Series.Item() where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item() Thank U very Much

      JO :)

      N Offline
      N Offline
      Nathan Holt at EMOM
      wrote on last edited by
      #2

      Ju@ncho wrote:

      I am programming a COM object in C++, to be used in a Visual Basic Apllication. I want to know if there is a way to separate the interface members with namespaces like this Study.FramesOfReference.Series.Item() where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item() Thank U very Much

      I wonder if you have your terminology right. A COM object can reasonably contain another COM object, but not a CoClass. Also, a method of a CoClass would be equivalent to a C++ static method, which I don't think COM supports either. Also neither containment of objects or CoClasses is considered a namespace. If you are using VB.NET, there is probably a way to import COM objects into specific namespaces, even though COM doesn't really support namespaces. In both VB.NET and VB6, a COM object Study can have a property FrameOfReference, which is an object that has a property named Series, which is an object with an Item method. Is this what you were trying to say? Nathan

      J 1 Reply Last reply
      0
      • J Ju ncho

        Hi, I am programming a COM object in C++, to be used in a Visual Basic Apllication. I want to know if there is a way to separate the interface members with namespaces like this Study.FramesOfReference.Series.Item() where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item() Thank U very Much

        JO :)

        K Offline
        K Offline
        Kuryn
        wrote on last edited by
        #3

        Quit posting the same question but with different termnology. Seen the same post in the ATL forum. But asking for ATL namespace.

        1 Reply Last reply
        0
        • N Nathan Holt at EMOM

          Ju@ncho wrote:

          I am programming a COM object in C++, to be used in a Visual Basic Apllication. I want to know if there is a way to separate the interface members with namespaces like this Study.FramesOfReference.Series.Item() where Study is a COM Object that contains a CoClass FramesOfReference which Contains a CoClass Series wich has a method Item() Thank U very Much

          I wonder if you have your terminology right. A COM object can reasonably contain another COM object, but not a CoClass. Also, a method of a CoClass would be equivalent to a C++ static method, which I don't think COM supports either. Also neither containment of objects or CoClasses is considered a namespace. If you are using VB.NET, there is probably a way to import COM objects into specific namespaces, even though COM doesn't really support namespaces. In both VB.NET and VB6, a COM object Study can have a property FrameOfReference, which is an object that has a property named Series, which is an object with an Item method. Is this what you were trying to say? Nathan

          J Offline
          J Offline
          Ju ncho
          wrote on last edited by
          #4

          When i said Coclass i was trying to say a COM Object or a C++ Object, so what i want to do, like you say is: having a property Frame of Reference which is an Object that has a property named Series named Series Which is an Object with an Item Methhod , the diffulty arises when i try to use properties which are objects. Especially with IDL. Do you know if i can use C++ objects as properties in ATL or i have to use COM objects, in that case which parameters i Have to use in the definition of the property in mi idl file? Thank you very much

          JO :)

          N L 2 Replies Last reply
          0
          • J Ju ncho

            When i said Coclass i was trying to say a COM Object or a C++ Object, so what i want to do, like you say is: having a property Frame of Reference which is an Object that has a property named Series named Series Which is an Object with an Item Methhod , the diffulty arises when i try to use properties which are objects. Especially with IDL. Do you know if i can use C++ objects as properties in ATL or i have to use COM objects, in that case which parameters i Have to use in the definition of the property in mi idl file? Thank you very much

            JO :)

            N Offline
            N Offline
            Nathan Holt at EMOM
            wrote on last edited by
            #5

            Ju@ncho wrote:

            Do you know if i can use C++ objects as properties in ATL or i have to use COM objects, in that case which parameters i Have to use in the definition of the property in mi idl file?

            COM objects would definitely be more apropriate. They only need to have CoClasses if you need a client to be able to create instances of them directly. Within your own code, you can create an object without a CoClass using CComObject::CreateInstance() It is possible to use plain structures if you don't need to fully support automation. (Visual Basic can handle structures though.) You need to define your structures in the idl file, and you should give each structure type its own guid. Nathan

            1 Reply Last reply
            0
            • J Ju ncho

              When i said Coclass i was trying to say a COM Object or a C++ Object, so what i want to do, like you say is: having a property Frame of Reference which is an Object that has a property named Series named Series Which is an Object with an Item Methhod , the diffulty arises when i try to use properties which are objects. Especially with IDL. Do you know if i can use C++ objects as properties in ATL or i have to use COM objects, in that case which parameters i Have to use in the definition of the property in mi idl file? Thank you very much

              JO :)

              L Offline
              L Offline
              Lim Bio Liong
              wrote on last edited by
              #6

              Hello Ju@ncho, There are two ways you can achieve your design : 1. By declaring the object properties "FramesOfReference" and "Series" as of their individual interface types (e.g. IFramesOfReference, ISeries, respectively) : interface IStudy : IDispatch { [propget, id(1), helpstring("property FramesOfReference")] HRESULT FramesOfReference([out, retval] IFramesOfReference** pVal); [propput, id(1), helpstring("property FramesOfReference")] HRESULT FramesOfReference([in] IFramesOfReference* newVal); } interface IFramesOfReference : IDispatch { [propget, id(1), helpstring("property Series")] HRESULT Series([out, retval] ISeries** pVal); [propput, id(1), helpstring("property Series")] HRESULT Series([in] ISeries* newVal); } 2. By delaring the object properties as of type VARIANT : interface IStudy : IDispatch { [propget, id(1), helpstring("property FramesOfReference")] HRESULT FramesOfReference([out, retval] VARIANT *pVal); [propput, id(1), helpstring("property FramesOfReference")] HRESULT FramesOfReference([in] VARIANT newVal); }; interface IFramesOfReference : IDispatch { [propget, id(1), helpstring("property Series")] HRESULT Series([out, retval] VARIANT *pVal); [propput, id(1), helpstring("property Series")] HRESULT Series([in] VARIANT newVal); }; I have written a set of sample codes. Email me : bio_lim_2004@yahoo.com and I will send it to you. Best Regards, - Bio.

              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