CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    9

    IPersistStreamInitImpl and problem of saving BSTRs

    I've created some component using ATL.
    I want my ActiveX property "BSTR m_MyStr" to be persistable.
    In order to make IPersistStreamInitImpl to save my property I
    added the next string to the property map.

    BEGIN_PROP_MAP(CMyControl)
    PROP_DATA_ENTRY("_My", m_MyStr, VT_BSTR)
    END_PROP_MAP()

    But it saves only pointer to my string, not the text.
    How can I solve the problem of saving BSTR properties?

    Thanks in advance



  2. #2
    Join Date
    May 1999
    Posts
    48

    Re: IPersistStreamInitImpl and problem of saving BSTRs

    Override the IPersistStreamInit_Save function in your control, and save a CComBSTR, which have WriteToStream functio,
    In implemetation of IPersistStreamInit_Save, call first AtlIPersistStreamInit_Save, to save all PROP_.... The same thing for loading operation.
    Sincerely, Mihai



  3. #3
    Join Date
    May 1999
    Posts
    9

    Re: IPersistStreamInitImpl and problem of saving BSTRs

    Thanks!
    But why isn't there a standart implementation
    in ATL?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured