BEEPER: Demonstrates a Tearoff Interface

Click to open or copy the BEEPER project files.

This basic sample illustrates the implementation of a tearoff interface - a collection/enumeration of BSTR values. It can be built as a DLL and as an EXE.

The sample MINIMAL shows how to build a DLL that does not link in the C run-time libraries (how to use #define _ATL_MIN_CRT).

Running the Sample

Build BEEPER (.exe or .dll) and make sure it is registered. Load the .vbp file into Visual Basic and run the program. Press the button to activate the application. With the DLL version, you can also run the application from Beeper.htm (an HTML file that uses VB Script) in Internet Explorer 3.0 or 4.0.

This sample uses the following keywords:

BEGIN_COM_MAP; CComCoClass; CComModule::Unlock; CComObjectRoot; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_TEAR_OFF; DECLARE_GET_CONTROLLING_UNKNOWN; DECLARE_NOT_AGGREGATABLE; DECLARE_REGISTRY; END_COM_MAP; FinalConstruct; IDispatchImpl; ISupportErrorInfo; PostThreadMessage; return Error; SysAllocString; THREADFLAGS_BOTH