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. IPersistPropertyBag/IPersistPropertyBagImpl question

IPersistPropertyBag/IPersistPropertyBagImpl question

Scheduled Pinned Locked Moved ATL / WTL / STL
questionhelp
6 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.
  • V Offline
    V Offline
    Vermithrax
    wrote on last edited by
    #1

    Has anyone used this successfully? :) I need to do something so simple it's pathetic, but I haven't figured out HOW... Here's what I want to do: I'd like to have a webpage that loads my dll (it's in a cab and all that)... And it's being called like this:

    <object classid="clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" codebase="XXXXXX.CAB">
    <param name="text" value="Yo man!">
    </object>

    So here's the deal... All I want said application to do... Is to be able to get that text in the param tag!!! Any hints/code snippets in the right direction? :) I've been having a bugger of a time, and Microsoft's help pages are of NO help for a newb like me! :) I know it's probably something easy, but I can't get it to work! Thanks in advance!

    J 1 Reply Last reply
    0
    • V Vermithrax

      Has anyone used this successfully? :) I need to do something so simple it's pathetic, but I haven't figured out HOW... Here's what I want to do: I'd like to have a webpage that loads my dll (it's in a cab and all that)... And it's being called like this:

      <object classid="clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" codebase="XXXXXX.CAB">
      <param name="text" value="Yo man!">
      </object>

      So here's the deal... All I want said application to do... Is to be able to get that text in the param tag!!! Any hints/code snippets in the right direction? :) I've been having a bugger of a time, and Microsoft's help pages are of NO help for a newb like me! :) I know it's probably something easy, but I can't get it to work! Thanks in advance!

      J Offline
      J Offline
      Jason De Arte
      wrote on last edited by
      #2

      The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface ITestControl & the class name CTestControl, I would do the following... * Inherit from IPersistPropertyBagImpl * add COM_INTERFACE_ENTRY(IPersistPropertyBag) to BEGIN_COM_MAP(CTestControl) * Add a member variable that will store the "Yo man!", maybe CComBSTR m_bsText; * In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look for BEGIN_PROP_MAP(CTestControl) - Add the entry PROP_DATA_ENTRY("test",1,CLSID_NULL). Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)" to assign newVal to the local variable m_bsText. Now when your control loads, IPersistPropertyBagImpl will call CTestControl::put_test(BSTR newVal) and store the value "Yo man!" in m_bsText

      V 2 Replies Last reply
      0
      • J Jason De Arte

        The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface ITestControl & the class name CTestControl, I would do the following... * Inherit from IPersistPropertyBagImpl * add COM_INTERFACE_ENTRY(IPersistPropertyBag) to BEGIN_COM_MAP(CTestControl) * Add a member variable that will store the "Yo man!", maybe CComBSTR m_bsText; * In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look for BEGIN_PROP_MAP(CTestControl) - Add the entry PROP_DATA_ENTRY("test",1,CLSID_NULL). Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)" to assign newVal to the local variable m_bsText. Now when your control loads, IPersistPropertyBagImpl will call CTestControl::put_test(BSTR newVal) and store the value "Yo man!" in m_bsText

        V Offline
        V Offline
        Vermithrax
        wrote on last edited by
        #3

        Wow, thanks SO much. :) That totally answers my question. :) I'll give it a try and see what happens. Thanks again, Jason!

        1 Reply Last reply
        0
        • J Jason De Arte

          The problem is that the simple stuff doesn't work with BSTRs In DevStudio6, If my ATL control had the interface ITestControl & the class name CTestControl, I would do the following... * Inherit from IPersistPropertyBagImpl * add COM_INTERFACE_ENTRY(IPersistPropertyBag) to BEGIN_COM_MAP(CTestControl) * Add a member variable that will store the "Yo man!", maybe CComBSTR m_bsText; * In workspace view, right click on ITestControl, and select "Add Property" - Set the property type to BSTR, - the name to "test", - uncheck "Get Function" - leave "Put Function" enabled - Remember the "id(n)" number displayed in the implementation preview at the bottom of the dialog, you'll need that. It's the dispatch ID * In your header file, look for BEGIN_PROP_MAP(CTestControl) - Add the entry PROP_DATA_ENTRY("test",1,CLSID_NULL). Observe that the number (in this case 1) is THE SAME dispatch ID for the property you just added! * Modify the newly created "CTestControl::put_test(BSTR newVal)" to assign newVal to the local variable m_bsText. Now when your control loads, IPersistPropertyBagImpl will call CTestControl::put_test(BSTR newVal) and store the value "Yo man!" in m_bsText

          V Offline
          V Offline
          Vermithrax
          wrote on last edited by
          #4

          Well, I gave that a try... The only thing is this... ;) I had to add these two parts in: (110) BEGIN_COM_MAP(CIEBand) (111) COM_INTERFACE_ENTRY(IPersistPropertyBag) (112) END_COM_MAP() (113) (114) BEGIN_PROP_MAP(CIEBand) (115) PROP_DATA_ENTRY("text",1,CLSID_NULL) (116) END_PROP_MAP() I didn't have the com or prop maps in there before... When I went to compile, it crapped out on the PROP_DATA_ENTRY line, with the following error(s): IEBand.h(115) : error C2059: syntax error : 'constant' IEBand.h(115) : error C2059: syntax error : ',' IEBand.h(116) : error C2143: syntax error : missing ';' before '{' IEBand.h(116) : error C2447: '{' : missing function header (old-style formal list?) IEBand.h(116) : error C2059: syntax error : '}' IEBand.h(116) : error C2059: syntax error : 'return' IEBand.h(116) : error C2059: syntax error : '}' YOUCH! :P Any thoughts on this?

          J 1 Reply Last reply
          0
          • V Vermithrax

            Well, I gave that a try... The only thing is this... ;) I had to add these two parts in: (110) BEGIN_COM_MAP(CIEBand) (111) COM_INTERFACE_ENTRY(IPersistPropertyBag) (112) END_COM_MAP() (113) (114) BEGIN_PROP_MAP(CIEBand) (115) PROP_DATA_ENTRY("text",1,CLSID_NULL) (116) END_PROP_MAP() I didn't have the com or prop maps in there before... When I went to compile, it crapped out on the PROP_DATA_ENTRY line, with the following error(s): IEBand.h(115) : error C2059: syntax error : 'constant' IEBand.h(115) : error C2059: syntax error : ',' IEBand.h(116) : error C2143: syntax error : missing ';' before '{' IEBand.h(116) : error C2447: '{' : missing function header (old-style formal list?) IEBand.h(116) : error C2059: syntax error : '}' IEBand.h(116) : error C2059: syntax error : 'return' IEBand.h(116) : error C2059: syntax error : '}' YOUCH! :P Any thoughts on this?

            J Offline
            J Offline
            Jason De Arte
            wrote on last edited by
            #5

            Whoops! :doh: **PROP_ENTRY**("test", 1, CLSID_NULL) Did I mention that individual milage may vary? ;)

            V 1 Reply Last reply
            0
            • J Jason De Arte

              Whoops! :doh: **PROP_ENTRY**("test", 1, CLSID_NULL) Did I mention that individual milage may vary? ;)

              V Offline
              V Offline
              Vermithrax
              wrote on last edited by
              #6

              Heheheh. :) Yeah, figured that out JUST a second ago. :P Thanks a ton, buddy. :)

              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