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 intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

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.

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

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

NoteNote

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.

Show: