BldRec: Uses Automation to Record Time and Length of a Build

Click to open or copy the BLDREC project files.

BldRec records the following build information in a text file:

The sample also shows using the registry to persist a setting. BldRec was created with the ATL COM AppWizard. Support MFC was checked in the wizard, and then an Add-in object was added to the project with the ATL Object Wizard.

To build the sample

  1. Click the link at the beginning of this topic to download the sample files.

  2. In Visual C++, open the project file BldRec.dsp.

  3. Choose an appropriate configuration (Win32 Release is best if you plan to use this add-in).

  4. Click Rebuild All from the Build menu.

To run the add-in

  1. From the Tools menu, click Customize.

  2. Click the Add-ins and Macro Files tab.

  3. Select the BldRec.dll file or browse for it. See Tips for Using Add-ins.

  4. Once the BldRec add-in has been loaded, clicking the button on its toolbar displays a dialog box that lets you specify a location to log build time information. The file is persistent; any changes to it will be used next time.

Output of BldRec is similar to:

09:48:11 PM 02/19/98 :             Build Started  -- bldrec - Win32 Debug
09:48:25 PM 02/19/98 : 00:00:14    Build Finished! Errors=0, Warnings=0 -- bldrec - Win32 Debug

This sample demonstrates the following keywords:

CTimeSpan; CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue; addin; customize; IApplication; IConfiguration; IApplicationEvents