This documentation is archived and is not being maintained.

ATLMovie Attributes Sample: Uses Compiler COM Support and Active Movie Interfaces in an ATL Control

The ATLMovie attributes sample is an ATL control that demonstrates how to use compiler COM support and the Active Movie interfaces to play a movie. It implements several COM properties and methods on its IMovieCtl interface.

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.

To build and run this sample

  1. Open the solution file ATLMovie.sln.

  2. From the Build menu, click Build.

  3. After the sample builds, open MovieCtl.htm in your Web browser. This will play the clock.avi file, which ships with Windows.

    You may need to edit MovieCtl.htm and update the line:

    MovieCtl.FileName = "C:\Winnt\Clock.AVI"

    to point to the location of the Clock.AVI file on your particular system.





The file name of the movie to play.





Pause the currently playing movie.


Play the movie pointed to by the FileName property.


Reset the playing position to the beginning of the movie.


Stop the movie.

This sample uses the following attributes:

coclass, dual, emitidl, helpstring, id, in, module, object, oleautomation, pointer_default, progid, propput, registration_script, threading, uuid

This sample uses the following keywords:

BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRootEx; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COM_INTERFACE_ENTRY_IMPL_IID; CreateBrushIndirect; CreateFilterGraph; CWindow::GetDC; DECLARE_REGISTRY_RESOURCEID; DeleteObject; DisableThreadLibraryCalls; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; FillRect; GetProperty; IDispatchImpl; IMediaControlPtr::Pause; IMediaControlPtr::Release; IMediaControlPtr::RenderFile; IMediaControlPtr::Run; IMediaControlPtr::Stop; IMediaPositionPtr::CurrentPosition; IMediaPositionPtr::Duration; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::SetObjectRects; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IVideoWindowPtr ::Owner IVideoWindowPtr::CreateInstance; IVideoWindowPtr::Owner ; IVideoWindowPtr::SetWindowPosition; IVideoWindowPtr::Visible ; IVideoWindowPtr::WindowStyle ; IViewObjectExImpl; MESSAGE_HANDLER; OBJECT_ENTRY; OffsetRect; OleTranslateColor; Reset; SetWindowPosition; SysFreeString


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.