Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Setting Properties with OLE Automation

0.00/5 (No votes)
5 Aug 2000 1  
Describes an ActiveX Control to use OLE Automation to set an object's properties.
  • Download demo project - 113 Kb
  • Download source files - 114 Kb
  • Sample Image - PropertySetCtl.jpg

    Table of Contents.

    1. Introduction
    2. How it works
    3. Control interface
    4. Source interface
    5. User interface
    6. Environment
    7. Acknowledgement, References
    8. Some words about VB demo

    Introduction

    kPropertySet.kObserver - This ActiveX control provides a way for presenting and editing of the set of properties (Visual Basic IDE - like property browser).

    The main features are:

    1. Editing a set of properties through the IDispatch interface.
    2. Works with IPerPropertyBrowsing and ICategorizeProperties interfaces
    3. Supports any type of property compatible with OLE automation
    4. Supports user-defined types
    5. Sorting for alphabet and categories
    6. Flexible customization
    7. Small size: 73.5 KB in release min size configuration

    How it works

    After receiving the pointer from the IDispatch interface, the control explores the type library. For each property with attribute "propget" there is an object implementing the logic of visualization, data exchange and data validation. The properties with attributes "hidden", "nonbrowsable", and "restricted" are skipped.


    Control interface

    The following is a description of the kObserver interface:

    Property Dispatch:
    External dispatch interface.

    Property Font:
    Current font.

    Property BackColor:
    Back color of list view window.

    Property ForeColor:
    Foreground color used for display text.

    Property GridColor:
    Color used for display grid.

    Property HighliteBackColor:
    Color used for display selected item.

    Property HighliteForeColor:
    Color used for display text of selected item.

    Property EditBackColor:
    Background color used for display edit window.

    Property EditForeColor:
    Foreground color used for display text in edit window.

    Property SignColor:
    The sign color.

    Property EnableContextMenu:
    Must be false if show of the context menu is unnecessary.

    Property Categorized:
    Sort mode, true if sorting by categories.

    Property LineSpacing:
    Additional spacing between rows can be negative.

    Property exStyleEdit:
    Extended window style of edit window.

    Property SelectName:
    Name of active property.

    Property SelectDesc:
    Description of active property.

    Property SelectValue:
    Value of active property.

    Property SelectDispid:
    DISPID of active property.


    Source interface

    Method OnChangeSelect:
    Occurs when user changes the active property.


    User interface

    Keyboard keys:

    • F5: refresh
    • F2, tab: edit property (if possible)
    • Space: simulate right button click

    Context Menu:

    • Alphabetic \ Categorized: select sort mode
    • Restore \ Customize Self: edit self property or external
    • Refresh: repaint and reload property value

    Environment

    This component was created with VC 6.0. (SP3) and ATL. It has been tested on Windows 2000 and Windows 98. Requires: Windows 98, Windows NT 4.0, Windows 2000, and Interned Explorer 4.


    Acknowledgement, References

    The following source code was used in writing this ActiveX control:

    Thanks them once more.

    Some words about VB demo

    For persisting \ restoreing the property in VB runtime I write the kPersistMngs.kStorageMng component. It's a simple wrapper to work with compound files in VB.

    History

    • 6 Aug 2000 - updated to version 1.2 and fixes bugs detected by Robert Rolls

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here