CIRC Attributes Sample: Demonstrates Using Property Pages

The CIRC attributes sample shows how to use ATL to make a simple ActiveX control. The sample creates a control that draws a circle and demonstrates property pages, control painting, use of color and caption properties, Click and KeyPress events, and a Color property page.

The CIRC sample is the nonattributed version of this sample.

Security noteSecurity Note:

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To get samples and instructions for installing them:

  • On the Visual Studio Help menu, click Samples.

    For more information, see Visual Studio Samples.

  • The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.

Building and Running the Sample

To build and run this sample

  1. Open the solution file circ.sln.

  2. From the Build menu, click Build Solution.

  3. Insert the control into a control container like ActiveX Control Test Container and test its properties and events. For details on accessing Test Container and using it to test a control, see Testing Properties and Events with Test Container.

Attributes

This sample uses the following attributes:

coclass, dispinterface, dll, dual, event_source, helpstring, id, implements_category, in, module, name, object, out, pointer_default, propget, propput, propputref, retval, support_error_info, uuid

Keywords

This sample uses the following keywords:

AtlCreateTargetDC; ATLTRACE; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CCircPropertyPageDlg ; CComCoClass; CComControl; CComControl::SetDirty; CComObjectRoot; CDialogImpl; CHAIN_MSG_MAP; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IID; COM_INTERFACE_ENTRY_IMPL; COMMAND_ID_HANDLER; CONNECTION_POINT_ENTRY; CProxy_CircEvents; CreateEllipticRgn; CreatePen; CreateSolidBrush; CStockPropImpl; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; Ellipse; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; GetClientRect; GetDialogBaseUnits; GetStockObject; GetTextMetrics; IConnectionPointContainerImpl; IConnectionPointImpl; IDataObjectImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleLinkImpl; IOleObjectImpl; IOleObjectImpl::DoVerb; IPerPropertyBrowsingImpl; IPersistPropertyBagImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IPropertyPageImpl; IPropertyPageImpl::SetObjects; IProvideClassInfo2Impl; IQuickActivateImpl; IQuickActivateImpl::QuickActivate; IRunnableObjectImpl; ISpecifyPropertyPagesImpl; IViewObjectExImpl; MESSAGE_HANDLER; OBJECT_ENTRY; OleTranslateColor; PROP_ENTRY; SelectObject; SendDlgItemMessage; SetBkMode; SetTextColor; SetWindowRgn; USES_CONVERSION

Note

Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.

See Also

Other Resources

ATL Attributes Samples