COM component Design and application (18)--Property package

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.