This article supporting source code
First, the preface
Book on the back, this landing in the introduction of the property package IPersistPropertyBag interface implementation methods and invocation. Property packs, which provide support for component persistence in a "name-value" manner, and "name-value" is just as appropriate for textual representation. The following fragment is the style after inserting Microsoft MonthView control ActiveX controls in HTML:
<object classid="clsid:232E456A-87C3-11D1-8BE3-0000F8754DA1" id="MonthView1">
<param name="_ExtentX" value="9393">
<param name="_ExtentY" value="4974">
<param name="_Version" value="393216">
<param name="ForeColor" value="0">
<param name="MaxSelCount" value="7">
<param name="MonthColumns" value="1">
<param name="CurrentDate" value="38632">
<param name="MaxDate" value="2958465">
<param name="MinDate" value="-53688">
</object>
Saving component properties in text is straightforward and easy to modify, with the <param name= "property name" value= "Value" > in the HTML example above clear. Here's how to implement the IPersistPropertyBag interface in your component.
Second, the implementation of components
(1) vc6.0 Development steps
1, to establish a working space (WorkSpace).
2, in this workspace, the establishment of the ATL Project, sample program engineering for SIMPLE18.
3, add the ATL object class, default all options. The ATL object short name in the sample program is property.
4, add some attributes. In the previous chapter, we only introduced the method of adding interface functions, because today is the first time to increase the interface properties, so a little more detailed. Step is, after selecting the interface (iproperty) in the ClassView card, execute the right mouse button menu "Add property ..."
5, increase the BSTR type of the interface attribute STR, the same way, and then add a long interface property Interger. In the sample program, these two properties are only for demonstration purposes and have no practical meaning.