ATLFire Sample: Demonstrates Building a Windowed Control

The ATLFire sample is an ActiveX control that demonstrates how to build a windowed control using ATL by setting the m_bWindowedOnly flag to TRUE. It also shows what needs to be done to the MFC drawing code to convert it into straight Win32 code. The sample uses the ATL support for Win32 dialog boxes and property sheets and also demonstrates how to use a Win32 tab control in an ActiveX control. The sample also demonstrates several of the ATL macros.

The ATLFire attributes sample is the attributed 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 ATLFire.sln.

  2. From the Build menu, click Build.

  3. After the sample builds, open FireTabCtrl.htm in your Web browser and try out the various types of fire that the sample simulates.

You can test the ATLFire 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.

Classes and Keywords

This sample uses the following ATL classes:

CComObjectRootEx, CComCoClass, CComControl, IDispatchImpl, IProvideClassInfo2Impl, IPersistStreamInitImpl, IPersistStorageImpl, IPersistPropertyBagImpl, IPerPropertyBrowsingImpl, IQuickActivateImpl, IObjectSafetyImpl, IOleControlImpl, IOleObjectImpl, IOleInPlaceActiveObjectImpl, IViewObjectExImpl, IOleInPlaceObjectWindowlessImpl, IDataObjectImpl, ISupportErrorInfo, ISpecifyPropertyPagesImpl, IConnectionPointContainerImpl, IPropertyNotifySinkCP, CDialogImpl

This sample uses the following keywords:

_ASSERTE; _itot; _tcstol; ALT_MSG_MAP; Apply; ATLTRACE; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRootEx; CDialogImpl; ClientToScreen; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; COMMAND_HANDLER; COMMAND_ID_HANDLER; CONNECTION_POINT_ENTRY; CPropDlg::DoModal; CreateBitmap; CreatePalette; DECLARE_REGISTRY_RESOURCEID; DeleteDC; DeleteObject; DestroyMenu; DisableThreadLibraryCalls; EnableWindow; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; EndDialog; FillRect; FireOnChanged; GetActiveWindow; GetClientRect; GetDlgItem; GetDlgItemText; GetModuleInstance; GetWindowRect; IConnectionPointContainerImpl; IDataObjectImpl; IDispatchImpl; InitFire; InlineIsEqualGUID; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleObjectImpl; IPersistPropertyBagImpl; IPersistStorageImpl; IPersistStreamInitImpl; IPropertyNotifySinkCP; IProvideClassInfo2Impl; IQuickActivateImpl; ISpecifyPropertyPagesImpl; ISupportErrorInfo; IViewObjectExImpl; memcpy; MESSAGE_HANDLER; MessageBox; NOTIFY_CODE_HANDLER; OBJECT_ENTRY; OnActivate; OnApply; OnCancel; OnCreate; OnDestroy; OnEraseBackground; OnInitDialog; OnOK; OnPaint; OnPaletteChanged; OnProperties; OnPropertyChanged; OnQueryNewPalette; OnRButtonDown; OnSelChanged; OnSelChanging; OnSize; OnTimer; PAINTSTRUCT ; PeekMessage; PROP_ENTRY; RealizePalette; SelectObject; SendMessage; SetTimer; SetWindowPos; TrackPopupMenuEx; UnregisterClass

See Also

Other Resources

ATL Samples