Attributes Tutorial
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Attributes Tutorial

Visual Studio .NET 2003

Using Visual C++ and attributes, you can speed up and simplify the process of COM programming. This tutorial uses attributes to implement both a client and a server application. During the course of this tutorial, you will use attributes and events.

The tutorial develops a singleton server object (an object that can have only one instance) that has its own dual interface and a dispatch interface used for firing off events. The server object takes data, given to it through the Send method of its dual interface, and transmits it to all connected components through the Transfer event on its dispatch interface.

In addition, the tutorial implements a client (an ActiveX control) that contains a server object. The control responds to the Transfer event fired by the server object and has its own dual interface that implements several methods: Connect, Send, and Disconnect. If the Transfer event is fired with a variant containing a BSTR, the string is displayed in the center of the control.

The tutorial is divided into seven steps, each building on the application developed in the previous step.

See Also

Attributed Programming | ATL Article Overview | ATL Class Overview | ATL Samples | Attributes Samples

© 2015 Microsoft