共用方式為


Options, ATL Simple Object Wizard

Use this page of the ATL Simple Object Wizard to design for increased efficiency and error support for the object.

For more information on ATL projects and ATL COM classes, see ATL COM Desktop Components.

  • Threading model
    Indicates the method for managing threads. By default, the project uses Apartment threading.

    See Specifying the Project's Threading Model for more information.

    Option

    Description

    Single

    Specifies that the object always runs in the primary COM thread. See Single-Threaded Apartments and InprocServer32 for more information.

    Apartment

    Specifies that the object uses apartment threading. Equivalent to single thread apartment. Each object of an apartment-threaded component is assigned an apartment for its thread, for the life of the object; however, multiple threads can be used for multiple objects. Each apartment is tied to a specific thread and has a Windows message pump (default).

    See Single-Threaded Apartments for more information.

    Both

    Specifies that the object can use either apartment or free threading, depending from which kind of a thread it is created.

    Free

    Specifies that the object uses free threading. Free threading is equivalent to a multithread apartment model. See Multithreaded Apartments for more information.

    Neutral (Windows 2000 only)

    Specifies that the object follows the guidelines for multithreaded apartments, but it can execute on any kind of thread.

  • Aggregation
    Indicates whether the object uses aggregation. The aggregate object chooses which interfaces to expose to clients, and the interfaces are exposed as if the aggregate object implemented them. Clients of the aggregate object communicate only with the aggregate object.

    Option

    Description

    Yes

    Specifies that the object can be aggregated. The default.

    No

    Specifies that the object is not aggregated.

    Only

    Specifies that the object must be aggregated.

  • Interface
    Indicates the type of interface the object supports. By default, the object supports a dual interface.

    Option

    Description

    Dual

    Specifies that the object supports a dual interface (its vtable has custom interface functions plus late-binding IDispatch methods). Allows both COM clients and Automation controllers to access the object. The default.

    Custom

    Specifies that the object supports a custom interface (its vtable has custom interface functions). A custom interface can be faster than a dual interface, especially across process boundaries.

    • Automation compatible   Allows Automation controllers to access an object that has the custom interface support.

  • Support
    Indicates additional support for the object.

    Option

    Description

    ISupportErrorInfo

    Creates support for the ISupportErrorInfo interface so the object can return error information to the client.

    Connection points

    Enables connection points for your object by making your object's class derive from IConnectionPointContainerImpl.

    Free-threaded marshaler

    Creates a free-threaded marshaler object to marshal interface pointers efficiently between threads in the same process. Available to object specifying Both as the threading model.

    IObjectWithSite (IE object support)

    Implements IObjectWithSiteImpl, which provides a simple way to support communication between an object and its site in a container.

See Also

Tasks

Adding an ATL Simple Object

Reference

ATL Simple Object Wizard

In-Process Server Threading Issues