POLYGON Attributes Sample: Demonstrates Custom Properties, Events, a Property Page, and Object Safety
The POLYGON attributes sample shows how to implement custom properties, events, a property page, and object safety for an ATL control. The POLYGON sample is the nonattributed version of this sample and is used as the basis of the ATL Tutorial.
Security 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
Open the solution file Polygon.sln.
From the Build menu, click Build.
After the sample builds, open PolyCtl.htm in your Web browser and try out the Polygon control. If you click inside the polygon, the number of sides increases. If you click outside the polygon, the number of sides decreases.
You can test the Polygon control in the ActiveX Control Test Container. 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, default, dispinterface, dual, event_source, helpstring, id, implements_category, in, module, object, out, pointer_default, progid, propget, propput, registration_script, retval, support_error_info, threading, uuid, version, vi_progid
Keywords
This sample uses the following keywords:
ATLASSERT; ATLTRACE; auxWireSphere; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; ChoosePixelFormat; CoTaskMemAlloc; CreateContext; CreateRGBPalette; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DescribePixelFormat; DisableThreadLibraryCalls; DrawText; END_CONNECTION_POINT_MAP; END_OBJECT_MAP; FireViewChange; GetClientRect; GetPixelFormat; glBegin; glClear; glClearColor; glClearDepth; glColor3f; glEnable; glEnd; glFinish; glLoadIdentity; glMatrixMode; glPopMatrix; glPushMatrix; glRotatef; glTranslatef; gluPerspective; glVertex3f; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl ; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IViewObjectExImpl; joyReleaseCapture; joySetThreshold; memcpy; OBJECT_ENTRY; PIXELFORMATDESCRIPTOR; RealizePalette; ReleaseCapture; SelectPalette; SetBkMode; SetCapture; SetTextColor; SwapBuffers; USES_CONVERSION; wglCreateContext; wglDeleteContext; wglGetCurrentDC; wglMakeCurrent
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.