Share via

ATLCON Attributes Sample: Demonstrates Creating a Simple Container

The ATLCON attribute sample demonstrates creating a simple container. The container implements the IOleClientSite, IOleWindow, and IOleInPlaceSite interfaces.

The ATLCON sample is the nonattributed version of this sample.


This sample may not exactly demonstrate some features of the Visual C++ wizards, libraries, and compiler, but it still shows how to complete the intended task.

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.

Building and Running the Sample

To build and run this sample

  1. Open the solution ATLCon.sln.

  2. From the Build menu, click Build Solution.

  3. From the Debug menu, click Start Without Debugging.

  4. Once the sample is running, use its File menu to insert a control into the container.


This sample uses the following attributes:

coclass, default, dual, exe, helpstring, id, in, module, name, object, out, pointer_default, propget, propput, retval, uuid


This sample uses the following keywords:

TLASSERT; ATLTRACENOTIMPL; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; CComCoClass; CComModule::Unlock; CComObjectRoot; CComQIPtr; CExeModule::Init; CExeModule::RegisterClassObjects; CExeModule::RegisterServer; CExeModule::RevokeClassObjects; CExeModule::Unlock; CExeModule::UnregisterServer; CExeModule::UpdateRegistryFromResource; Close; CoCreateInstance; CoInitialize; COM_INTERFACE_ENTRY; COMMAND_ID_HANDLER; CoUninitialize; CWindowImpl; DECLARE_REGISTRY_RESOURCEID; DispatchMessage; DoVerb; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; GetClientRect; GetCommandLine; GetCurrentThreadId; GetDesktopWindow; GetMessage; GetResourceInstance; IAtlCon; IOleClientSite; IOleInPlaceSite; LoadMenu; LPOLEINPLACEFRAMEINFO; LPRECT; MESSAGE_HANDLER; MessageBox; OBJECT_ENTRY; PostQuitMessage; PostThreadMessage; SetClientSite; SetObjectRects; ShowWindow; TranslateMessage; ZeroMemory

See Also

Other Resources

ATL Attributes Samples