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. ActiveX (ATL) question?

ActiveX (ATL) question?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++com
4 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.
  • J Offline
    J Offline
    jancsi
    wrote on last edited by
    #1

    I created an ATL project and inserted into it a Composite Control Object. It works fine , but need to read some info from the browser specified in the OBJECT tag ... ... How I read the MyValue from my ATL Composite Control? Thankx:eek: xxx

    A P 2 Replies Last reply
    0
    • J jancsi

      I created an ATL project and inserted into it a Composite Control Object. It works fine , but need to read some info from the browser specified in the OBJECT tag ... ... How I read the MyValue from my ATL Composite Control? Thankx:eek: xxx

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      I figure you would have better luck in the COM section. You wanna use the tag. I dunno if i'm right with the following(i'm tired haven't slept yet) but I think what you want is custom properties in COM there is no such thing as just assigning values to your object data members, you MUST use get/set mutators and accessors. Your gonna need something similar to this:

      STDMETHODIMP IMyInterface::get_MyAttrib(BSTR* pVal)
      {
      m_MyMember = *pVal;
      return S_OK;
      }

      //Also you need some way to tie the attribute to your variable
      //This is accomplished through IDL, I don't have a reference handy so don't ask...

      This might be entirely wrong, but will give you some starting ground p.s-If your building a control for web sites only...have you considered using IE lite...? less overhead and better suited for webpages.:) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

      1 Reply Last reply
      0
      • J jancsi

        I created an ATL project and inserted into it a Composite Control Object. It works fine , but need to read some info from the browser specified in the OBJECT tag ... ... How I read the MyValue from my ATL Composite Control? Thankx:eek: xxx

        P Offline
        P Offline
        Paul M Watt
        wrote on last edited by
        #3

        Besides creating the get and set member functions for the member variable, you will need to derive your class from IPersist.

        P 1 Reply Last reply
        0
        • P Paul M Watt

          Besides creating the get and set member functions for the member variable, you will need to derive your class from IPersist.

          P Offline
          P Offline
          Paul M Watt
          wrote on last edited by
          #4

          You are not bothering me, I like to help. Anyways, here are some segments of code from a control that I wrote. First declare the property get_ and put_ functions in idl. [ object, uuid(...), dual, helpstring("IHTMLInfoCtl Interface"), pointer_default(unique) ] interface IHTMLInfoCtl : IDispatch { **[propput, id(0)] HRESULT URL([in]BSTR pVal); [propget, id(0)] HRESULT URL([out,retval]BSTR* newVal);** }; Next implement these functions in your class interface. The key to tying the data together is deriving your ATL object from the IPersistStream interface, then providing one of the IPersist implementations. I used IPersistePropertyBagImpl and it works fine. I am not sure, but I think that One of the IPersistxxx classes that I have declared may not need to be declared, but this code works for me. class ATL_NO_VTABLE CHTMLInfoCtl : public CComObjectRootEx, public CComCoClass, ... **public IPersistStreamInitImpl, public IPersistStorageImpl,** ... **public IPersistPropertyBagImpl,** ... { public: CHTMLInfoCtl(); ~CHTMLInfoCtl(); ... One final thing, add the IPersist entries to your COM map here. BEGIN_COM_MAP(CHTMLInfoCtl) COM_INTERFACE_ENTRY(IHTMLInfoCtl) ... **COM_INTERFACE_ENTRY(IPersistStorage) COM_INTERFACE_ENTRY(IPersistStreamInit) COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit) COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistPropertyBag) COM_INTERFACE_ENTRY(IPersistPropertyBag)** END_COM_MAP() **BEGIN_PROP_MAP(CHTMLInfoCtl) PROP_ENTRY("URL", 0, CLSID_NULL) END_PROP_MAP()** // IHTMLInfoCtl public: STDMETHOD(get_URL)(BSTR *pVal); STDMETHOD(put_URL)(BSTR newURL); private: CComBSTR m_bstrURL; }; let me know if you have other questions.

          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